diff --git a/.github/workflows/ci-reusable.yml b/.github/workflows/ci-reusable.yml index ba898432..a74e20eb 100644 --- a/.github/workflows/ci-reusable.yml +++ b/.github/workflows/ci-reusable.yml @@ -63,7 +63,7 @@ jobs: npm install - name: Run Ethereum node with Codex contracts - if: matrix.tests == 'contract' || matrix.tests == 'tools' || matrix.tests == 'all' + if: matrix.tests == 'contract' || matrix.tests == 'integration' || matrix.tests == 'tools' || matrix.tests == 'all' working-directory: vendor/codex-contracts-eth env: MSYS2_PATH_TYPE: inherit @@ -82,6 +82,10 @@ jobs: if: matrix.tests == 'integration' || matrix.tests == 'all' env: CODEX_INTEGRATION_TEST_INCLUDES: ${{ matrix.includes }} + run: make -j${ncpu} ENABLE_PARALLEL_TESTS=0 testIntegration + + - name: Parallel integration tests + if: matrix.tests == 'integration-parallel' run: make -j${ncpu} DEBUG_CODEXNODES=1 DEBUG_TESTHARNESS=1 DEBUG_UPDATES=1 testIntegration - name: Upload integration tests log files diff --git a/Makefile b/Makefile index d1e2ac16..5cdea524 100644 --- a/Makefile +++ b/Makefile @@ -156,6 +156,9 @@ endif ifdef TEST_TIMEOUT TEST_PARAMS := $(TEST_PARAMS) -d:TestTimeout=$(TEST_TIMEOUT) endif +ifdef ENABLE_PARALLEL_TESTS + TEST_PARAMS := $(TEST_PARAMS) -d:EnableParallelTests=$(ENABLE_PARALLEL_TESTS) +endif # Builds and runs the integration tests testIntegration: | build deps diff --git a/build.nims b/build.nims index 38ac11d1..e2581ceb 100644 --- a/build.nims +++ b/build.nims @@ -55,6 +55,7 @@ task testIntegration, "Run integration tests": for i in 2 ..< paramCount(): if "DebugTestHarness" in paramStr(i) and truthy paramStr(i).split('=')[1]: testParams = "-d:chronicles_log_level=TRACE -d:chronicles_sinks=textlines[stdout]" + break test "testIntegration", params = testParams # use params to enable logging from the integration test executable # test "testIntegration", params = "-d:chronicles_sinks=textlines[notimestamps,stdout],textlines[dynamic] " & diff --git a/tests/testIntegration.nim b/tests/testIntegration.nim index 90eb463c..108ec7f5 100644 --- a/tests/testIntegration.nim +++ b/tests/testIntegration.nim @@ -37,6 +37,8 @@ const ShowContinuousStatusUpdates {.booldefine.} = false # Timeout duration (in mimutes) for EACH integration test file. const TestTimeout {.intdefine.} = 60 +const EnableParallelTests {.booldefine.} = true + proc run() {.async.} = when DebugTestHarness and enabledLogLevel != LogLevel.TRACE: styledEcho bgWhite, @@ -81,4 +83,17 @@ proc run() {.async.} = if not wasSuccessful: quit(1) # indicate with a non-zero exit code that the tests failed -waitFor run() +when EnableParallelTests: + waitFor run() +else: + # run tests serially + import ./integration/testcli + import ./integration/testrestapi + import ./integration/testupdownload + import ./integration/testsales + import ./integration/testpurchasing + import ./integration/testblockexpiration + import ./integration/testmarketplace + import ./integration/testproofs + import ./integration/testvalidator + import ./integration/testecbug