diff --git a/.github/workflows/check-pr.yml b/.github/workflows/check-pr.yml
index 3c3b2246..66e0d718 100644
--- a/.github/workflows/check-pr.yml
+++ b/.github/workflows/check-pr.yml
@@ -6,6 +6,16 @@ jobs:
check-pr:
name: Check PR
runs-on: ubuntu-latest
+ env:
+ BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
+ services:
+ docker:
+ image: docker:latest
+ options: --privileged # Required for Docker-in-Docker (dind)
+ volumes:
+ - /var/run/docker.sock:/var/run/docker.sock
+ ports:
+ - 2375:2375
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
@@ -13,5 +23,23 @@ jobs:
distribution: 'temurin'
java-version: '11'
cache: 'sbt'
+ - uses: sbt/setup-sbt@v1
+ # - name: Install dependencies
+ # # testcontainers uses nc:
+ # # https://github.com/testcontainers/testcontainers-java/blob/main/core/src/main/java/org/testcontainers/containers/wait/internal/InternalCommandPortListeningCheck.java#L33
+ # run: sudo apt-get update && sudo apt-get install -y netcat
+ - name: Generate genesis.conf
+ run: |
+ cd local-network
+ sh genesis-update.sh
- name: Check PR
- run: sbt --batch "compile;test"
+ # run: sbt --batch "docker;consensus-client-it/test"
+ run: sbt --batch "consensus-client-it/test"
+ - name: Archive logs
+ uses: actions/upload-artifact@v4
+ if: always()
+ with:
+ name: test-logs_${{ env.BRANCH_NAME }}_${{ github.run_id }}
+ path: consensus-client-it/target/test-logs
+ if-no-files-found: warn
+ retention-days: 14
diff --git a/consensus-client-it/build.sbt b/consensus-client-it/build.sbt
index d93cfa82..992c9197 100644
--- a/consensus-client-it/build.sbt
+++ b/consensus-client-it/build.sbt
@@ -1,5 +1,6 @@
import com.github.sbt.git.SbtGit.git.gitCurrentBranch
import sbt.Tests.Group
+import sbt.util
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
@@ -24,19 +25,20 @@ inConfig(Test)(
javaOptions ++= Seq(
s"-Dlogback.configurationFile=${(Test / resourceDirectory).value}/logback-test.xml", // Fixes a logback blaming for multiple configs
s"-Dcc.it.configs.dir=${baseDirectory.value.getParent}/local-network/configs",
- s"-Dcc.it.docker.image=consensus-client:${gitCurrentBranch.value}"
+ s"-Dcc.it.docker.image=ghcr.io/unitsnetwork/consensus-client:testnet-2",
+ // s"-Dcc.it.docker.image=consensus-client:${gitCurrentBranch.value}",
+ s"-Dcc.it.logs.dir=${(Test / logsDirectory).value}"
),
testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-fFWD", ((Test / logsDirectory).value / "summary.log").toString),
parallelExecution := true,
testGrouping := {
- val PORTS_PER_TEST = 50
- val DEFAULT_PORT_RANGE = (10000, 32000)
-
val javaHomeValue = (test / javaHome).value
val logDirectoryValue = (Test / logsDirectory).value
val envVarsValue = (Test / envVars).value
val javaOptionsValue = (Test / javaOptions).value
+ streams.value.log.log(util.Level.Info, s"javaOptions: ${javaOptionsValue.mkString(", ")}; logsDirectory: $logDirectoryValue")
+
val tests = (Test / definedTests).value
tests.zipWithIndex.map { case (suite, i) =>
diff --git a/consensus-client-it/src/test/resources/logback-test.xml b/consensus-client-it/src/test/resources/logback-test.xml
index ce24c467..01166258 100644
--- a/consensus-client-it/src/test/resources/logback-test.xml
+++ b/consensus-client-it/src/test/resources/logback-test.xml
@@ -22,12 +22,11 @@
-
+
-
-
+
diff --git a/consensus-client-it/src/test/scala/units/network/BaseItTestSuite.scala b/consensus-client-it/src/test/scala/units/network/BaseItTestSuite.scala
index ced811b6..3814d400 100644
--- a/consensus-client-it/src/test/scala/units/network/BaseItTestSuite.scala
+++ b/consensus-client-it/src/test/scala/units/network/BaseItTestSuite.scala
@@ -10,10 +10,12 @@ import org.scalatest.concurrent.Eventually
import org.scalatest.freespec.AnyFreeSpec
import org.scalatest.matchers.should.Matchers
import org.scalatest.{BeforeAndAfterAll, EitherValues, OptionValues}
+import org.testcontainers.containers.output.OutputFrame.OutputType
import units.network.test.docker.{EcContainer, Networks, WavesNodeContainer}
import units.test.CustomMatchers
import java.nio.charset.StandardCharsets
+import java.nio.file.{Files, Path}
trait BaseItTestSuite
extends AnyFreeSpec
@@ -41,12 +43,28 @@ trait BaseItTestSuite
super.beforeAll()
log.debug(s"Docker network name: ${network.getName}, id: ${network.getId}") // Force create network
- ec1.start()
- ec1.logPorts()
-
waves1.start()
waves1.waitReady()
waves1.logPorts()
+
+ Thread.sleep(10000)
+
+ Files.write(
+ Path.of(System.getProperty("cc.it.logs.dir"), "waves-container.log"),
+ waves1.container.getLogs().getBytes(StandardCharsets.UTF_8)
+ )
+
+ log.info(s"Last height: ${waves1.api.height}") // TODO remove
+
+ ec1.start()
+ ec1.logPorts()
+ log.info(s"Last execution block: ${ec1.engineApi.getLastExecutionBlock}") // Works // TODO remove
+
+// waves1.start()
+// waves1.waitReady()
+// waves1.logPorts()
+// Thread.sleep(10000)
+// log.info(s"Last height: ${waves1.api.height}") // TODO remove
}
override protected def afterAll(): Unit = {
diff --git a/consensus-client-it/src/test/scala/units/network/test/docker/WavesNodeContainer.scala b/consensus-client-it/src/test/scala/units/network/test/docker/WavesNodeContainer.scala
index afcc8a6b..4b87cb4f 100644
--- a/consensus-client-it/src/test/scala/units/network/test/docker/WavesNodeContainer.scala
+++ b/consensus-client-it/src/test/scala/units/network/test/docker/WavesNodeContainer.scala
@@ -22,7 +22,8 @@ class WavesNodeContainer(
chainContractAddress: Address,
ecEngineApiUrl: String
) extends BaseContainer(s"wavesnode-$number") {
- protected override val container = new GenericContainer(DockerImageName.parse(System.getProperty("cc.it.docker.image")))
+ // protected
+ override val container = new GenericContainer(DockerImageName.parse(System.getProperty("cc.it.docker.image")))
.withNetwork(network)
.withExposedPorts(ApiPort)
.withEnv(