diff --git a/.circleci/config.yml b/.circleci/config.yml index ce4d45299b..a5d9637eb7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -217,6 +217,14 @@ workflows: - /rel\/.*/ - /hotfix\/.*/ context: slack-secrets + - tests_verification_job: + name: << matrix.job_type >>_<< matrix.job_version >>_verification + matrix: + parameters: + job_type: ["amd64", "arm64", "mac_amd64"] + job_version: ["test", "test_nightly", "integration", "integration_nightly", "e2e_expect", "e2e_expect_nightly"] + requires: + - << matrix.job_type >>_<< matrix.job_version >> #- windows_x64_build commands: @@ -327,10 +335,13 @@ commands: short_test_flag: type: string default: "" + result_path: + type: string + default: "/tmp/results" steps: - attach_workspace: at: << parameters.circleci_home >> - - run: mkdir -p /tmp/results/<< parameters.result_subdir >> + - run: mkdir -p << parameters.result_path >>/<< parameters.result_subdir >>/$CIRCLE_NODE_INDEX - restore_cache: keys: - 'go-cache-{{ .Environment.CIRCLE_STAGE }}-' @@ -354,12 +365,16 @@ commands: export PARTITION_TOTAL=$CIRCLE_NODE_TOTAL export PARTITION_ID=$CIRCLE_NODE_INDEX export PARALLEL_FLAG="-p 1" - gotestsum --format pkgname --junitfile /tmp/results/<< parameters.result_subdir >>/results.xml --jsonfile /tmp/results/<< parameters.result_subdir >>/testresults.json -- --tags "sqlite_unlock_notify sqlite_omit_load_extension" << parameters.short_test_flag >> -race -timeout 1h -coverprofile=coverage.txt -covermode=atomic -p 1 $PACKAGE_NAMES + gotestsum --format testname --junitfile << parameters.result_path >>/<< parameters.result_subdir >>/${CIRCLE_NODE_INDEX}/results.xml --jsonfile << parameters.result_path >>/<< parameters.result_subdir >>/${CIRCLE_NODE_INDEX}/testresults.json -- --tags "sqlite_unlock_notify sqlite_omit_load_extension" << parameters.short_test_flag >> -race -timeout 1h -coverprofile=coverage.txt -covermode=atomic -p 1 $PACKAGE_NAMES - store_artifacts: - path: /tmp/results + path: << parameters.result_path >> destination: test-results - store_test_results: - path: /tmp/results + path: << parameters.result_path >> + - persist_to_workspace: + root: << parameters.result_path >> + paths: + - << parameters.result_subdir >> - save_cache: key: 'go-cache-{{ .Environment.CIRCLE_STAGE }}-{{ .Environment.CIRCLE_BUILD_NUM }}' paths: @@ -388,10 +403,13 @@ commands: short_test_flag: type: string default: "" + result_path: + type: string + default: "/tmp/results" steps: - attach_workspace: at: << parameters.circleci_home >> - - run: mkdir -p /tmp/results/<< parameters.result_subdir >> + - run: mkdir -p << parameters.result_path >>/<< parameters.result_subdir >>/$CIRCLE_NODE_INDEX - run: name: Run integration tests no_output_timeout: << parameters.no_output_timeout >> @@ -409,15 +427,39 @@ commands: scripts/buildtools/install_buildtools.sh -o "gotest.tools/gotestsum" export ALGOTEST=1 export SHORTTEST=<< parameters.short_test_flag >> - export TEST_RESULTS=/tmp/results/<< parameters.result_subdir >> + export TEST_RESULTS=<< parameters.result_path >>/<< parameters.result_subdir >>/$CIRCLE_NODE_INDEX export PARTITION_TOTAL=$CIRCLE_NODE_TOTAL export PARTITION_ID=$CIRCLE_NODE_INDEX test/scripts/run_integration_tests.sh - store_artifacts: - path: /tmp/results + path: << parameters.result_path >> destination: test-results - store_test_results: - path: /tmp/results + path: << parameters.result_path >> + - persist_to_workspace: + root: << parameters.result_path >> + paths: + - << parameters.result_subdir >> + + tests_verification_command: + description: Check if all tests were run at least once and only once across all parallel runs + parameters: + result_path: + type: string + default: "/tmp/results" + result_subdir: + type: string + steps: + - attach_workspace: + at: << parameters.result_path >> + - run: + name: Check if all tests were run + command: | + cat << parameters.result_path >>/<< parameters.result_subdir >>/**/testresults.json > << parameters.result_path >>/<< parameters.result_subdir >>/combined_testresults.json + python3 scripts/buildtools/check_tests.py << parameters.result_path >>/<< parameters.result_subdir >>/combined_testresults.json + - store_artifacts: + path: << parameters.result_path >>/<< parameters.result_subdir >> + destination: << parameters.result_subdir >>/combined-test-results jobs: codegen_verification: @@ -449,7 +491,7 @@ jobs: steps: - prepare_go - generic_buildtest: - result_subdir: amd64-short + result_subdir: amd64_test short_test_flag: "-short" - upload_coverage @@ -461,7 +503,7 @@ jobs: steps: - prepare_go - generic_buildtest: - result_subdir: amd64-nightly + result_subdir: amd64_test_nightly no_output_timeout: 45m - upload_coverage - slack/notify: @@ -478,7 +520,7 @@ jobs: steps: - prepare_go - generic_integration: - result_subdir: amd64-integration + result_subdir: amd64_integration short_test_flag: "-short" amd64_integration_nightly: @@ -491,7 +533,7 @@ jobs: steps: - prepare_go - generic_integration: - result_subdir: amd64-integrationnightly + result_subdir: amd64_integration_nightly no_output_timeout: 45m - slack/notify: event: fail @@ -506,7 +548,7 @@ jobs: steps: - prepare_go - generic_integration: - result_subdir: amd64-e2e_subs + result_subdir: amd64_e2e_subs short_test_flag: "-short" amd64_e2e_subs_nightly: @@ -518,7 +560,7 @@ jobs: steps: - prepare_go - generic_integration: - result_subdir: amd64-e2e_subs_nightly + result_subdir: amd64_e2e_subs_nightly no_output_timeout: 45m - slack/notify: event: fail @@ -527,25 +569,27 @@ jobs: amd64_e2e_expect: machine: image: ubuntu-2004:202104-01 - resource_class: large + resource_class: medium + parallelism: 2 environment: E2E_TEST_FILTER: "EXPECT" steps: - prepare_go - generic_integration: - result_subdir: amd64-e2e_subs + result_subdir: amd64_e2e_expect short_test_flag: "-short" amd64_e2e_expect_nightly: machine: image: ubuntu-2004:202104-01 - resource_class: large + resource_class: medium + parallelism: 2 environment: E2E_TEST_FILTER: "EXPECT" steps: - prepare_go - generic_integration: - result_subdir: amd64-e2e_subs_nightly + result_subdir: amd64_e2e_expect_nightly no_output_timeout: 45m - slack/notify: event: fail @@ -569,7 +613,7 @@ jobs: - checkout - prepare_go - generic_buildtest: - result_subdir: arm64-short + result_subdir: arm64_test short_test_flag: "-short" - upload_coverage @@ -582,7 +626,7 @@ jobs: - checkout - prepare_go - generic_buildtest: - result_subdir: arm64-nightly + result_subdir: arm64_test_nightly no_output_timeout: 45m - upload_coverage - slack/notify: @@ -600,7 +644,7 @@ jobs: - checkout - prepare_go - generic_integration: - result_subdir: arm64-integration + result_subdir: arm64_integration short_test_flag: "-short" arm64_integration_nightly: @@ -614,7 +658,7 @@ jobs: - checkout - prepare_go - generic_integration: - result_subdir: arm64-integration-nightly + result_subdir: arm64_integration_nightly no_output_timeout: 45m - slack/notify: event: fail @@ -630,7 +674,7 @@ jobs: - checkout - prepare_go - generic_integration: - result_subdir: arm64-e2e_subs + result_subdir: arm64_e2e_subs short_test_flag: "-short" arm64_e2e_subs_nightly: @@ -643,7 +687,7 @@ jobs: - checkout - prepare_go - generic_integration: - result_subdir: arm64-e2e_subs-nightly + result_subdir: arm64_e2e_subs_nightly no_output_timeout: 45m - slack/notify: event: fail @@ -652,27 +696,29 @@ jobs: arm64_e2e_expect: machine: image: ubuntu-2004:202101-01 - resource_class: arm.large + resource_class: arm.medium + parallelism: 2 environment: E2E_TEST_FILTER: "EXPECT" steps: - checkout - prepare_go - generic_integration: - result_subdir: arm64-e2e_subs + result_subdir: arm64_e2e_expect short_test_flag: "-short" arm64_e2e_expect_nightly: machine: image: ubuntu-2004:202101-01 - resource_class: arm.large + resource_class: arm.medium + parallelism: 2 environment: E2E_TEST_FILTER: "EXPECT" steps: - checkout - prepare_go - generic_integration: - result_subdir: arm64-e2e_subs-nightly + result_subdir: arm64_e2e_expect_nightly no_output_timeout: 45m - slack/notify: event: fail @@ -702,7 +748,7 @@ jobs: #- run: git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow - prepare_go - generic_buildtest: - result_subdir: mac-amd64-short + result_subdir: mac_amd64_test circleci_home: /Users/distiller short_test_flag: "-short" - upload_coverage @@ -718,7 +764,7 @@ jobs: #- run: git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow - prepare_go - generic_buildtest: - result_subdir: mac-amd64-short + result_subdir: mac_amd64_test_nightly circleci_home: /Users/distiller no_output_timeout: 45m - upload_coverage @@ -738,7 +784,7 @@ jobs: #- run: git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow - prepare_go - generic_integration: - result_subdir: mac-amd64-integration + result_subdir: mac_amd64_integration circleci_home: /Users/distiller short_test_flag: "-short" @@ -754,7 +800,7 @@ jobs: #- run: git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow - prepare_go - generic_integration: - result_subdir: mac-amd64-integration-nightly + result_subdir: mac_amd64_integration_nightly circleci_home: /Users/distiller no_output_timeout: 45m - slack/notify: @@ -772,7 +818,7 @@ jobs: #- run: git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow - prepare_go - generic_integration: - result_subdir: mac-amd64-e2e_subs + result_subdir: mac_amd64_e2e_subs circleci_home: /Users/distiller short_test_flag: "-short" @@ -787,7 +833,7 @@ jobs: #- run: git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow - prepare_go - generic_integration: - result_subdir: mac-amd64-e2e_subs-nightly + result_subdir: mac_amd64_e2e_subs_nightly circleci_home: /Users/distiller no_output_timeout: 45m - slack/notify: @@ -797,7 +843,8 @@ jobs: mac_amd64_e2e_expect: macos: xcode: 12.0.1 - resource_class: large + resource_class: medium + parallelism: 2 environment: E2E_TEST_FILTER: "EXPECT" HOMEBREW_NO_AUTO_UPDATE: "true" @@ -805,14 +852,15 @@ jobs: #- run: git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow - prepare_go - generic_integration: - result_subdir: mac-amd64-e2e_subs + result_subdir: mac_amd64_e2e_expect circleci_home: /Users/distiller short_test_flag: "-short" mac_amd64_e2e_expect_nightly: macos: xcode: 12.0.1 - resource_class: large + resource_class: medium + parallelism: 2 environment: E2E_TEST_FILTER: "EXPECT" HOMEBREW_NO_AUTO_UPDATE: "true" @@ -820,7 +868,7 @@ jobs: #- run: git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow - prepare_go - generic_integration: - result_subdir: mac-amd64-e2e_subs-nightly + result_subdir: mac_amd64_e2e_expect_nightly circleci_home: /Users/distiller no_output_timeout: 45m - slack/notify: @@ -845,3 +893,16 @@ jobs: export MAKE=mingw32-make $msys2 scripts/travis/build_test.sh shell: bash.exe + tests_verification_job: + docker: + - image: python:3.9.6-alpine + resource_class: small + parameters: + job_type: # job_type: ["amd64", "arm64", "mac_amd64"] + type: string + job_version: # job_version: ["test", "test_nightly", "integration", "integration_nightly", "e2e_expect", "e2e_expect_nightly"] + type: string + steps: + - checkout + - tests_verification_command: + result_subdir: << parameters.job_type >>_<< parameters.job_version >> diff --git a/agreement/agreementtest/simulate_test.go b/agreement/agreementtest/simulate_test.go index c4ccb69b15..086349b82d 100644 --- a/agreement/agreementtest/simulate_test.go +++ b/agreement/agreementtest/simulate_test.go @@ -37,6 +37,7 @@ import ( "github.com/algorand/go-algorand/data/committee" "github.com/algorand/go-algorand/logging" "github.com/algorand/go-algorand/protocol" + "github.com/algorand/go-algorand/test/partitiontest" "github.com/algorand/go-algorand/util/db" ) @@ -294,6 +295,8 @@ func (l *testLedger) EnsureDigest(c agreement.Certificate, verifier *agreement.A } func TestSimulate(t *testing.T) { + partitiontest.PartitionTest(t) + f, _ := os.Create(t.Name() + ".log") logging.Base().SetJSONFormatter() logging.Base().SetOutput(f) diff --git a/agreement/fuzzer/tests_test.go b/agreement/fuzzer/tests_test.go index f05852e39a..22e1cc049b 100644 --- a/agreement/fuzzer/tests_test.go +++ b/agreement/fuzzer/tests_test.go @@ -25,6 +25,7 @@ import ( "math" "math/rand" "os" + //ossignal "os/signal" "path/filepath" //"runtime/pprof" @@ -36,6 +37,7 @@ import ( "github.com/algorand/go-algorand/logging" "github.com/algorand/go-deadlock" + //"github.com/algorand/go-algorand/protocol" "github.com/algorand/go-algorand/test/partitiontest" ) @@ -105,6 +107,8 @@ func testConfig(t *testing.T, config NetworkConfig) (network *Network) { */ func TestCircularNetworkTopology(t *testing.T) { + // partitiontest.PartitionTest(t) + // Causes double partition, so commented out on purpose var nodeCounts []int if testing.Short() { nodeCounts = []int{4, 6} @@ -422,6 +426,8 @@ type FuzzerTestFile struct { } func TestFuzzer(t *testing.T) { + // partitiontest.PartitionTest(t) + // Causes double partition, so commented out on purpose jsonFiles := make(map[string]string) // map json test to full json file name. err := filepath.Walk(".", func(path string, info os.FileInfo, err error) error { if strings.HasSuffix(info.Name(), ".json") { @@ -475,6 +481,8 @@ func TestFuzzer(t *testing.T) { } func TestNetworkBandwidth(t *testing.T) { + // partitiontest.PartitionTest(t) + // Causes double partition, so commented out on purpose // travis rans out of memory when we get a high nodes count.. so we'll skip it for now. if testing.Short() { t.Skip() diff --git a/cmd/algofix/deadlock_test.go b/cmd/algofix/deadlock_test.go index f1f3aa1b04..2c21115850 100644 --- a/cmd/algofix/deadlock_test.go +++ b/cmd/algofix/deadlock_test.go @@ -25,6 +25,7 @@ import ( "strings" "testing" + "github.com/algorand/go-algorand/test/partitiontest" "github.com/stretchr/testify/require" ) @@ -130,6 +131,7 @@ func main() { ` func TestDeadlockRewrite(t *testing.T) { + partitiontest.PartitionTest(t) t.Run("simple", func(t *testing.T) { testDeadlock(t, deadlockSimpleSrc, deadlockSimpleDest) }) t.Run("onoff", func(t *testing.T) { testDeadlock(t, deadlockTestSrc, deadlockTestFin) }) } diff --git a/cmd/algofix/main_test.go b/cmd/algofix/main_test.go index c2ace28caa..fad46ca7cc 100644 --- a/cmd/algofix/main_test.go +++ b/cmd/algofix/main_test.go @@ -9,6 +9,8 @@ import ( "go/parser" "strings" "testing" + + "github.com/algorand/go-algorand/test/partitiontest" ) type testCase struct { @@ -73,6 +75,7 @@ func parseFixPrint(t *testing.T, fn func(*ast.File) bool, desc, in string, mustB } func TestRewrite(t *testing.T) { + partitiontest.PartitionTest(t) for _, tt := range testCases { // Apply fix: should get tt.Out. out, fixed, ok := parseFixPrint(t, tt.Fn, tt.Name, tt.In, true) diff --git a/cmd/algoh/blockWatcher_test.go b/cmd/algoh/blockWatcher_test.go index 5aeec20640..8ed724c20c 100644 --- a/cmd/algoh/blockWatcher_test.go +++ b/cmd/algoh/blockWatcher_test.go @@ -23,6 +23,7 @@ import ( "time" "github.com/algorand/go-algorand/daemon/algod/api/spec/v1" + "github.com/algorand/go-algorand/test/partitiontest" "github.com/stretchr/testify/require" ) @@ -38,6 +39,7 @@ func bw(client Client) *blockWatcher { // When the status continues to report block 300 // Then blockIfStalled will block until the next block is reported func TestBlockIfStalled(t *testing.T) { + partitiontest.PartitionTest(t) client := mockClient{ error: []error{nil, nil, nil}, status: makeNodeStatuses(300, 300, 300, 301), @@ -59,6 +61,7 @@ func TestBlockIfStalled(t *testing.T) { // When the status continues to increase quickly // Then blockIfCatchup will block until a block is reported twice func TestBlockIfCatchup(t *testing.T) { + partitiontest.PartitionTest(t) client := mockClient{ error: []error{nil, nil, nil}, status: makeNodeStatuses(301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 310), @@ -80,6 +83,7 @@ func TestBlockIfCatchup(t *testing.T) { // When the status is not changing quickly // Then blockIfCatchup will return after the first status call. func TestBlockIfCaughtUp(t *testing.T) { + partitiontest.PartitionTest(t) client := mockClient{ error: []error{nil, nil, nil}, status: makeNodeStatuses(300), @@ -111,6 +115,7 @@ func (l *testlistener) onBlock(block v1.Block) { } func TestE2E(t *testing.T) { + partitiontest.PartitionTest(t) client := makeMockClient( []error{nil, nil, nil}, makeNodeStatuses(300, 301, 302, 302, 302, 302, 302, 302, 310, 320, 321, 321, 321, 322), @@ -159,6 +164,7 @@ func TestE2E(t *testing.T) { } func TestAbortDuringStall(t *testing.T) { + partitiontest.PartitionTest(t) client := makeMockClient( []error{}, makeNodeStatuses(300), diff --git a/cmd/algoh/blockstats_test.go b/cmd/algoh/blockstats_test.go index e96fffe6b0..d1b95003b2 100644 --- a/cmd/algoh/blockstats_test.go +++ b/cmd/algoh/blockstats_test.go @@ -22,6 +22,7 @@ import ( "github.com/algorand/go-algorand/daemon/algod/api/spec/v1" "github.com/algorand/go-algorand/logging/telemetryspec" + "github.com/algorand/go-algorand/test/partitiontest" "github.com/stretchr/testify/require" ) @@ -42,6 +43,7 @@ func (mes *MockEventSender) EventWithDetails(category telemetryspec.Category, id } func TestConsecutiveBlocks(t *testing.T) { + partitiontest.PartitionTest(t) sender := MockEventSender{} bs := blockstats{log: &sender} @@ -57,6 +59,7 @@ func TestConsecutiveBlocks(t *testing.T) { } func TestAgreementTime(t *testing.T) { + partitiontest.PartitionTest(t) sleepTime := 50 * time.Millisecond testAttempts := 0 const maxTestAttempts = 10 diff --git a/cmd/catchupsrv/download_test.go b/cmd/catchupsrv/download_test.go index 1a952cebe4..fa65f05fbf 100644 --- a/cmd/catchupsrv/download_test.go +++ b/cmd/catchupsrv/download_test.go @@ -17,11 +17,14 @@ package main import ( - "github.com/stretchr/testify/require" "testing" + + "github.com/algorand/go-algorand/test/partitiontest" + "github.com/stretchr/testify/require" ) func TestBlockToPath(t *testing.T) { + partitiontest.PartitionTest(t) require.Equal(t, "00/00/000000", blockToPath(0)) require.Equal(t, "00/00/0000rs", blockToPath(1000)) require.Equal(t, "05/yc/05ycfo", blockToPath(10000500)) @@ -29,6 +32,7 @@ func TestBlockToPath(t *testing.T) { } func TestBlockToFileName(t *testing.T) { + partitiontest.PartitionTest(t) require.Equal(t, "000000", blockToFileName(0)) require.Equal(t, "0000rs", blockToFileName(1000)) require.Equal(t, "05ycfo", blockToFileName(10000500)) @@ -36,6 +40,7 @@ func TestBlockToFileName(t *testing.T) { } func TestBlockToString(t *testing.T) { + partitiontest.PartitionTest(t) require.Equal(t, "0", blockToString(0)) require.Equal(t, "rs", blockToString(1000)) require.Equal(t, "5ycfo", blockToString(10000500)) diff --git a/cmd/goal/commands_test.go b/cmd/goal/commands_test.go index e997605924..26a621ea2b 100644 --- a/cmd/goal/commands_test.go +++ b/cmd/goal/commands_test.go @@ -20,10 +20,12 @@ import ( "os" "testing" + "github.com/algorand/go-algorand/test/partitiontest" "github.com/stretchr/testify/require" ) func TestEnsureDataDirReturnsWhenDataDirIsProvided(t *testing.T) { + partitiontest.PartitionTest(t) expectedDir := "~/.algorand" os.Setenv("ALGORAND_DATA", expectedDir) actualDir := ensureFirstDataDir() diff --git a/cmd/goal/formatting_test.go b/cmd/goal/formatting_test.go index e1fe731dc6..d5f216fd06 100644 --- a/cmd/goal/formatting_test.go +++ b/cmd/goal/formatting_test.go @@ -19,10 +19,12 @@ package main import ( "testing" + "github.com/algorand/go-algorand/test/partitiontest" "github.com/stretchr/testify/require" ) func TestUnicodePrintable(t *testing.T) { + partitiontest.PartitionTest(t) testUnicodePrintableStrings := []struct { testString string isPrintable bool diff --git a/cmd/goal/inspect_test.go b/cmd/goal/inspect_test.go index 2068a3a925..564f7611ba 100644 --- a/cmd/goal/inspect_test.go +++ b/cmd/goal/inspect_test.go @@ -25,9 +25,11 @@ import ( "github.com/algorand/go-algorand/data/basics" "github.com/algorand/go-algorand/data/transactions" "github.com/algorand/go-algorand/protocol" + "github.com/algorand/go-algorand/test/partitiontest" ) func TestInspect(t *testing.T) { + partitiontest.PartitionTest(t) var err error var empty transactions.SignedTxn diff --git a/cmd/tealdbg/cdtSession_test.go b/cmd/tealdbg/cdtSession_test.go index 1eb669126a..8ee0107be1 100644 --- a/cmd/tealdbg/cdtSession_test.go +++ b/cmd/tealdbg/cdtSession_test.go @@ -28,9 +28,11 @@ import ( "github.com/algorand/go-algorand/data/transactions" "github.com/algorand/go-algorand/data/transactions/logic" "github.com/algorand/go-algorand/protocol" + "github.com/algorand/go-algorand/test/partitiontest" ) func TestCdtSessionProto11Common(t *testing.T) { + partitiontest.PartitionTest(t) sid := "test" dbg := MockDebugControl{} ch := make(chan Notification) @@ -94,6 +96,7 @@ func TestCdtSessionProto11Common(t *testing.T) { } func TestCdtSessionProto11Breakpoints(t *testing.T) { + partitiontest.PartitionTest(t) sid := "test" dbg := MockDebugControl{} ch := make(chan Notification) @@ -178,6 +181,7 @@ func TestCdtSessionProto11Breakpoints(t *testing.T) { } func TestCdtSessionProto11Events(t *testing.T) { + partitiontest.PartitionTest(t) sid := "test" dbg := MockDebugControl{} ch := make(chan Notification) @@ -211,6 +215,7 @@ func TestCdtSessionProto11Events(t *testing.T) { } func TestCdtSessionProto11Controls(t *testing.T) { + partitiontest.PartitionTest(t) sid := "test" dbg := MockDebugControl{} ch := make(chan Notification) @@ -254,6 +259,7 @@ func TestCdtSessionProto11Controls(t *testing.T) { } func TestCdtSessionProto11Evaluate(t *testing.T) { + partitiontest.PartitionTest(t) sid := "test" dbg := MockDebugControl{} ch := make(chan Notification) @@ -292,6 +298,7 @@ func TestCdtSessionProto11Evaluate(t *testing.T) { } func TestCdtSessionProto11CallOnFunc(t *testing.T) { + partitiontest.PartitionTest(t) sid := "test" dbg := MockDebugControl{} ch := make(chan Notification) @@ -380,6 +387,7 @@ func TestCdtSessionProto11CallOnFunc(t *testing.T) { } func TestCdtSessionProto11GetProps(t *testing.T) { + partitiontest.PartitionTest(t) sid := "test" dbg := MockDebugControl{} ch := make(chan Notification) @@ -413,6 +421,7 @@ func TestCdtSessionProto11GetProps(t *testing.T) { } func TestCdtSessionStateToEvent(t *testing.T) { + partitiontest.PartitionTest(t) sid := "test" dbg := MockDebugControl{} ch := make(chan Notification) @@ -451,6 +460,7 @@ func TestCdtSessionStateToEvent(t *testing.T) { } func TestCdtSessionGetObjects(t *testing.T) { + partitiontest.PartitionTest(t) sid := "test" dbg := MockDebugControl{} ch := make(chan Notification) diff --git a/cmd/tealdbg/cdtdbg_test.go b/cmd/tealdbg/cdtdbg_test.go index 28c2417c32..fb6b4c0a69 100644 --- a/cmd/tealdbg/cdtdbg_test.go +++ b/cmd/tealdbg/cdtdbg_test.go @@ -29,9 +29,11 @@ import ( "github.com/algorand/go-algorand/cmd/tealdbg/cdt" "github.com/algorand/go-algorand/data/transactions/logic" + "github.com/algorand/go-algorand/test/partitiontest" ) func TestCdtHandlers(t *testing.T) { + partitiontest.PartitionTest(t) params := CdtFrontendParams{ router: mux.NewRouter(), apiAddress: "127.0.0.1:12345", @@ -142,6 +144,7 @@ func (c *MockDebugControl) GetStates(s *logic.DebugState) AppState { } func TestCdtFrontendSessionStarted(t *testing.T) { + partitiontest.PartitionTest(t) params := CdtFrontendParams{ router: mux.NewRouter(), apiAddress: "127.0.0.1:12345", @@ -178,6 +181,7 @@ func TestCdtFrontendSessionStarted(t *testing.T) { } func TestCdtAdapterSessionEnded(t *testing.T) { + partitiontest.PartitionTest(t) params := CdtFrontendParams{ router: mux.NewRouter(), apiAddress: "127.0.0.1:12345", diff --git a/cmd/tealdbg/debugger_test.go b/cmd/tealdbg/debugger_test.go index be517d5b44..d1d815b1a3 100644 --- a/cmd/tealdbg/debugger_test.go +++ b/cmd/tealdbg/debugger_test.go @@ -26,6 +26,7 @@ import ( "github.com/algorand/go-algorand/data/transactions" "github.com/algorand/go-algorand/data/transactions/logic" "github.com/algorand/go-algorand/protocol" + "github.com/algorand/go-algorand/test/partitiontest" ) type testDbgAdapter struct { @@ -91,6 +92,7 @@ func (d *testDbgAdapter) eventLoop() { } func TestDebuggerSimple(t *testing.T) { + partitiontest.PartitionTest(t) proto := config.Consensus[protocol.ConsensusV18] require.Greater(t, proto.LogicSigVersion, uint64(0)) debugger := MakeDebugger() @@ -122,6 +124,7 @@ int 1 } func TestSession(t *testing.T) { + partitiontest.PartitionTest(t) source := fmt.Sprintf("#pragma version %d\nint 1\ndup\n+\n", logic.LogicVersion) ops, err := logic.AssembleStringWithVersion(source, logic.LogicVersion) require.NoError(t, err) diff --git a/cmd/tealdbg/localLedger_test.go b/cmd/tealdbg/localLedger_test.go index ae941723a2..be2ef81898 100644 --- a/cmd/tealdbg/localLedger_test.go +++ b/cmd/tealdbg/localLedger_test.go @@ -26,6 +26,7 @@ import ( "github.com/algorand/go-algorand/data/transactions" "github.com/algorand/go-algorand/data/transactions/logic" "github.com/algorand/go-algorand/protocol" + "github.com/algorand/go-algorand/test/partitiontest" ) // Current implementation uses LegderForCowBase interface to plug into evaluator. @@ -34,6 +35,7 @@ import ( // This test ensures TEAL program sees data provided by LegderForCowBase, and sees all // intermediate changes. func TestBalanceAdapterStateChanges(t *testing.T) { + partitiontest.PartitionTest(t) a := require.New(t) source := `#pragma version 2 diff --git a/cmd/tealdbg/local_test.go b/cmd/tealdbg/local_test.go index 6a844963e5..da4e813069 100644 --- a/cmd/tealdbg/local_test.go +++ b/cmd/tealdbg/local_test.go @@ -31,6 +31,7 @@ import ( "github.com/algorand/go-algorand/data/transactions/logic" "github.com/algorand/go-algorand/ledger/apply" "github.com/algorand/go-algorand/protocol" + "github.com/algorand/go-algorand/test/partitiontest" "github.com/stretchr/testify/require" ) @@ -53,6 +54,7 @@ var txnSample string = `{ ` func TestTxnJSONInput(t *testing.T) { + partitiontest.PartitionTest(t) a := require.New(t) dp := DebugParams{ @@ -73,6 +75,7 @@ func TestTxnJSONInput(t *testing.T) { } func TestTxnMessagePackInput(t *testing.T) { + partitiontest.PartitionTest(t) a := require.New(t) var txn transactions.SignedTxn @@ -232,6 +235,7 @@ func makeSampleSerializedBalanceRecord(addr basics.Address, toJSON bool) []byte } func TestBalanceJSONInput(t *testing.T) { + partitiontest.PartitionTest(t) a := require.New(t) addr, err := basics.UnmarshalChecksumAddress("47YPQTIGQEO7T4Y4RWDYWEKV6RTR2UNBQXBABEEGM72ESWDQNCQ52OPASU") @@ -254,6 +258,7 @@ func TestBalanceJSONInput(t *testing.T) { } func TestBalanceMessagePackInput(t *testing.T) { + partitiontest.PartitionTest(t) a := require.New(t) addr, err := basics.UnmarshalChecksumAddress("47YPQTIGQEO7T4Y4RWDYWEKV6RTR2UNBQXBABEEGM72ESWDQNCQ52OPASU") a.NoError(err) @@ -281,6 +286,7 @@ func TestBalanceMessagePackInput(t *testing.T) { } func TestDebugEnvironment(t *testing.T) { + partitiontest.PartitionTest(t) a := require.New(t) sender, err := basics.UnmarshalChecksumAddress("47YPQTIGQEO7T4Y4RWDYWEKV6RTR2UNBQXBABEEGM72ESWDQNCQ52OPASU") @@ -521,6 +527,7 @@ byte 0x676c6f62616c // global } func TestDebugFromPrograms(t *testing.T) { + partitiontest.PartitionTest(t) a := require.New(t) txnBlob := []byte("[" + strings.Join([]string{string(txnSample), txnSample}, ",") + "]") @@ -599,6 +606,7 @@ func TestDebugFromPrograms(t *testing.T) { } func TestRunMode(t *testing.T) { + partitiontest.PartitionTest(t) a := require.New(t) txnBlob := []byte("[" + strings.Join([]string{string(txnSample), txnSample}, ",") + "]") @@ -685,6 +693,7 @@ func TestRunMode(t *testing.T) { } func TestDebugFromTxn(t *testing.T) { + partitiontest.PartitionTest(t) a := require.New(t) sender, err := basics.UnmarshalChecksumAddress("47YPQTIGQEO7T4Y4RWDYWEKV6RTR2UNBQXBABEEGM72ESWDQNCQ52OPASU") @@ -904,6 +913,7 @@ func checkBalanceAdapter( } func TestLocalBalanceAdapter(t *testing.T) { + partitiontest.PartitionTest(t) a := require.New(t) sender, err := basics.UnmarshalChecksumAddress("47YPQTIGQEO7T4Y4RWDYWEKV6RTR2UNBQXBABEEGM72ESWDQNCQ52OPASU") @@ -964,6 +974,7 @@ func TestLocalBalanceAdapter(t *testing.T) { } func TestLocalBalanceAdapterIndexer(t *testing.T) { + partitiontest.PartitionTest(t) a := require.New(t) sender, err := basics.UnmarshalChecksumAddress("47YPQTIGQEO7T4Y4RWDYWEKV6RTR2UNBQXBABEEGM72ESWDQNCQ52OPASU") diff --git a/cmd/tealdbg/remote_test.go b/cmd/tealdbg/remote_test.go index 863e303692..553bc4c564 100644 --- a/cmd/tealdbg/remote_test.go +++ b/cmd/tealdbg/remote_test.go @@ -28,9 +28,11 @@ import ( "github.com/algorand/go-algorand/data/transactions/logic" "github.com/algorand/go-algorand/protocol" + "github.com/algorand/go-algorand/test/partitiontest" ) func TestRemoteAdapterHandlers(t *testing.T) { + partitiontest.PartitionTest(t) d := MakeDebugger() a := MakeRemoteHook(d) router := mux.NewRouter() diff --git a/cmd/tealdbg/server_test.go b/cmd/tealdbg/server_test.go index aa138b30b3..232c6a6f4c 100644 --- a/cmd/tealdbg/server_test.go +++ b/cmd/tealdbg/server_test.go @@ -23,6 +23,7 @@ import ( "testing" "time" + "github.com/algorand/go-algorand/test/partitiontest" "github.com/gorilla/mux" "github.com/stretchr/testify/require" ) @@ -124,10 +125,12 @@ func serverTestImpl(t *testing.T, run func(t *testing.T, ds *DebugServer) bool, } func TestServerRemote(t *testing.T) { + partitiontest.PartitionTest(t) serverTestImpl(t, tryStartingServerRemote, &DebugParams{}) } func TestServerLocal(t *testing.T) { + partitiontest.PartitionTest(t) txnBlob := []byte("[" + strings.Join([]string{string(txnSample), txnSample}, ",") + "]") dp := DebugParams{ ProgramNames: []string{"test"}, diff --git a/cmd/tealdbg/util_test.go b/cmd/tealdbg/util_test.go index 459bd3a298..8613a398bd 100644 --- a/cmd/tealdbg/util_test.go +++ b/cmd/tealdbg/util_test.go @@ -19,10 +19,12 @@ package main import ( "testing" + "github.com/algorand/go-algorand/test/partitiontest" "github.com/stretchr/testify/require" ) func TestVLQ(t *testing.T) { + partitiontest.PartitionTest(t) a := require.New(t) a.Equal("AAAA", MakeSourceMapLine(0, 0, 0, 0)) diff --git a/cmd/tealdbg/webdbg_test.go b/cmd/tealdbg/webdbg_test.go index 76620a82f5..5f340ff6aa 100644 --- a/cmd/tealdbg/webdbg_test.go +++ b/cmd/tealdbg/webdbg_test.go @@ -23,11 +23,13 @@ import ( "net/http/httptest" "testing" + "github.com/algorand/go-algorand/test/partitiontest" "github.com/gorilla/mux" "github.com/stretchr/testify/require" ) func TestWebPageFrontendHandlers(t *testing.T) { + partitiontest.PartitionTest(t) params := WebPageFrontendParams{ router: mux.NewRouter(), apiAddress: "127.0.0.1:12345", diff --git a/cmd/updater/version_test.go b/cmd/updater/version_test.go index 9921161b09..2869461658 100644 --- a/cmd/updater/version_test.go +++ b/cmd/updater/version_test.go @@ -21,10 +21,12 @@ import ( "github.com/stretchr/testify/require" + "github.com/algorand/go-algorand/test/partitiontest" "github.com/algorand/go-algorand/util/s3" ) func TestGetVersion(t *testing.T) { + partitiontest.PartitionTest(t) testValidVersion(t, "algonode_update_0.1.0.log", uint64(0x00010000)) testValidVersion(t, "algo_update_0.1.0", uint64(0x00010000)) testValidVersion(t, "algo_update_65535.1.0", uint64(0xFFFF00010000)) diff --git a/crypto/curve25519_test.go b/crypto/curve25519_test.go index ea155e0704..7850048618 100644 --- a/crypto/curve25519_test.go +++ b/crypto/curve25519_test.go @@ -19,6 +19,8 @@ package crypto import ( "bytes" "testing" + + "github.com/algorand/go-algorand/test/partitiontest" ) func makeCurve25519Secret() *SignatureSecrets { @@ -28,6 +30,7 @@ func makeCurve25519Secret() *SignatureSecrets { } func TestSignVerifyEmptyMessage(t *testing.T) { + partitiontest.PartitionTest(t) pk, sk := ed25519GenerateKey() sig := ed25519Sign(sk, []byte{}) if !ed25519Verify(pk, []byte{}, sig) { @@ -36,6 +39,7 @@ func TestSignVerifyEmptyMessage(t *testing.T) { } func TestVerifyZeros(t *testing.T) { + partitiontest.PartitionTest(t) var pk SignatureVerifier var sig Signature for x := byte(0); x < 255; x++ { @@ -46,6 +50,7 @@ func TestVerifyZeros(t *testing.T) { } func TestGenerateSignatureSecrets(t *testing.T) { + partitiontest.PartitionTest(t) var s Seed RandBytes(s[:]) ref := GenerateSignatureSecrets(s) @@ -63,10 +68,12 @@ func TestGenerateSignatureSecrets(t *testing.T) { } func TestCurve25519SignVerify(t *testing.T) { + partitiontest.PartitionTest(t) signVerify(t, makeCurve25519Secret(), makeCurve25519Secret()) } func TestVRFProveVerify(t *testing.T) { + partitiontest.PartitionTest(t) proveVerifyVrf(t, GenerateVRFSecrets(), GenerateVRFSecrets()) } diff --git a/crypto/encoding_test.go b/crypto/encoding_test.go index 17e83b71f7..e5df42c9ef 100644 --- a/crypto/encoding_test.go +++ b/crypto/encoding_test.go @@ -18,11 +18,14 @@ package crypto import ( "testing" + + "github.com/algorand/go-algorand/test/partitiontest" // "github.com/stretchr/testify/require" // "github.com/algorand/go-algorand/protocol" ) func TestEmptyEncoding(t *testing.T) { + partitiontest.PartitionTest(t) // TODO systematically add checks for empty encodings // var s SignatureSecrets diff --git a/crypto/onetimesig_test.go b/crypto/onetimesig_test.go index ad9a109e1d..9f1b85f061 100644 --- a/crypto/onetimesig_test.go +++ b/crypto/onetimesig_test.go @@ -18,6 +18,8 @@ package crypto import ( "testing" + + "github.com/algorand/go-algorand/test/partitiontest" ) func randID() OneTimeSignatureIdentifier { @@ -30,6 +32,7 @@ func randID() OneTimeSignatureIdentifier { } func TestOneTimeSignVerifyNewStyle(t *testing.T) { + partitiontest.PartitionTest(t) c := GenerateOneTimeSignatureSecrets(0, 1000) c2 := GenerateOneTimeSignatureSecrets(0, 1000) testOneTimeSignVerifyNewStyle(t, c, c2) diff --git a/crypto/util_test.go b/crypto/util_test.go index 3cdba9e9c4..0488dcadbe 100644 --- a/crypto/util_test.go +++ b/crypto/util_test.go @@ -19,10 +19,12 @@ package crypto import ( "testing" + "github.com/algorand/go-algorand/test/partitiontest" "github.com/stretchr/testify/require" ) func TestEncodeDecode(t *testing.T) { + partitiontest.PartitionTest(t) toBeHashed := []byte("this is a test") hashed := Hash(toBeHashed) hashedStr := hashed.String() @@ -33,6 +35,7 @@ func TestEncodeDecode(t *testing.T) { } func TestDigest_IsZero(t *testing.T) { + partitiontest.PartitionTest(t) d := Digest{} require.True(t, d.IsZero()) require.Zero(t, d) diff --git a/crypto/vrf_test.go b/crypto/vrf_test.go index dc91653e7e..42e8dc7cc3 100644 --- a/crypto/vrf_test.go +++ b/crypto/vrf_test.go @@ -20,6 +20,8 @@ import ( "crypto/rand" "encoding/hex" "testing" + + "github.com/algorand/go-algorand/test/partitiontest" ) func mustDecode(t *testing.T, out []byte, hexIn string) { @@ -72,6 +74,7 @@ func testVector(t *testing.T, skHex, pkHex, alphaHex, piHex, betaHex string) { // ECVRF-ED25519-SHA512-Elligator2 test vectors from: https://www.ietf.org/id/draft-irtf-cfrg-vrf-03.txt appendix A.4 func TestVRFTestVectors(t *testing.T) { + partitiontest.PartitionTest(t) testVector(t, "9d61b19deffd5a60ba844af492ec2cc44449c5697b326919703bac031cae7f60", //sk "d75a980182b10ab7d54bfed3c964073a0ee172f3daa62325af021a68f707511a", //pk diff --git a/daemon/algod/api/server/lib/middlewares/auth_test.go b/daemon/algod/api/server/lib/middlewares/auth_test.go index 544875f37b..b0dd0fe260 100644 --- a/daemon/algod/api/server/lib/middlewares/auth_test.go +++ b/daemon/algod/api/server/lib/middlewares/auth_test.go @@ -21,6 +21,7 @@ import ( "net/http" "testing" + "github.com/algorand/go-algorand/test/partitiontest" "github.com/labstack/echo/v4" "github.com/stretchr/testify/require" ) @@ -36,6 +37,8 @@ func success(ctx echo.Context) error { } func TestAuth(t *testing.T) { + partitiontest.PartitionTest(t) + tokens := []string{"token1", "token2"} tests := []struct { diff --git a/daemon/algod/api/server/router_test.go b/daemon/algod/api/server/router_test.go index 3c0d8295af..7474165a94 100644 --- a/daemon/algod/api/server/router_test.go +++ b/daemon/algod/api/server/router_test.go @@ -56,14 +56,16 @@ func (s *TestSuite) SetupTest() { s.calls = 0 } func (s *TestSuite) TestBaselineRoute() { - partitiontest.PartitionTest(s.T()) + // partitiontest.PartitionTest(s.T()) + // Partitioning in TestTestSuite() ctx := s.e.NewContext(nil, nil) s.e.Router().Find(http.MethodGet, "/v0/this/is/no/endpoint", ctx) assert.Equal(s.T(), echo.ErrNotFound, ctx.Handler()(ctx)) assert.Equal(s.T(), 0, s.calls) } func (s *TestSuite) TestAccountPendingTransaction() { - partitiontest.PartitionTest(s.T()) + // partitiontest.PartitionTest(s.T()) + // Partitioning in TestTestSuite() ctx := s.e.NewContext(nil, nil) s.e.Router().Find(http.MethodGet, "/v1/account/address-param/transactions/pending", ctx) assert.Equal(s.T(), "/v1/account/:addr/transactions/pending", ctx.Path()) @@ -75,7 +77,8 @@ func (s *TestSuite) TestAccountPendingTransaction() { assert.Equal(s.T(), callsBefore+1, s.calls) } func (s *TestSuite) TestWaitAfterBlock() { - partitiontest.PartitionTest(s.T()) + // partitiontest.PartitionTest(s.T()) + // Partitioning in TestTestSuite() ctx := s.e.NewContext(nil, nil) s.e.Router().Find(http.MethodGet, "/v1/status/wait-for-block-after/123456", ctx) assert.Equal(s.T(), "/v1/status/wait-for-block-after/:round", ctx.Path()) @@ -87,7 +90,8 @@ func (s *TestSuite) TestWaitAfterBlock() { assert.Equal(s.T(), callsBefore+1, s.calls) } func (s *TestSuite) TestAccountInformation() { - partitiontest.PartitionTest(s.T()) + // partitiontest.PartitionTest(s.T()) + // Partitioning in TestTestSuite() ctx := s.e.NewContext(nil, nil) s.e.Router().Find(http.MethodGet, "/v1/account/ZBBRQD73JH5KZ7XRED6GALJYJUXOMBBP3X2Z2XFA4LATV3MUJKKMKG7SHA", ctx) assert.Equal(s.T(), "/v1/account/:addr", ctx.Path()) @@ -99,7 +103,8 @@ func (s *TestSuite) TestAccountInformation() { assert.Equal(s.T(), callsBefore+1, s.calls) } func (s *TestSuite) TestTransactionInformation() { - partitiontest.PartitionTest(s.T()) + // partitiontest.PartitionTest(s.T()) + // Partitioning in TestTestSuite() ctx := s.e.NewContext(nil, nil) addr := "ZBBRQD73JH5KZ7XRED6GALJYJUXOMBBP3X2Z2XFA4LATV3MUJKKMKG7SHA" txid := "ASPB5E72OT2UWSOCQGD5OPT3W4KV4LZZDL7L5MBCC3EBAIJCDHAA" @@ -114,7 +119,8 @@ func (s *TestSuite) TestTransactionInformation() { assert.Equal(s.T(), callsBefore+1, s.calls) } func (s *TestSuite) TestAccountTransaction() { - partitiontest.PartitionTest(s.T()) + // partitiontest.PartitionTest(s.T()) + // Partitioning in TestTestSuite() ctx := s.e.NewContext(nil, nil) addr := "ZBBRQD73JH5KZ7XRED6GALJYJUXOMBBP3X2Z2XFA4LATV3MUJKKMKG7SHA" s.e.Router().Find(http.MethodGet, "/v1/account/"+addr+"/transactions", ctx) @@ -127,7 +133,8 @@ func (s *TestSuite) TestAccountTransaction() { assert.Equal(s.T(), callsBefore+1, s.calls) } func (s *TestSuite) TestBlock() { - partitiontest.PartitionTest(s.T()) + // partitiontest.PartitionTest(s.T()) + // Partitioning in TestTestSuite() ctx := s.e.NewContext(nil, nil) s.e.Router().Find(http.MethodGet, "/v1/block/123456", ctx) assert.Equal(s.T(), "/v1/block/:round", ctx.Path()) @@ -139,7 +146,8 @@ func (s *TestSuite) TestBlock() { assert.Equal(s.T(), callsBefore+1, s.calls) } func (s *TestSuite) TestPendingTransactionID() { - partitiontest.PartitionTest(s.T()) + // partitiontest.PartitionTest(s.T()) + // Partitioning in TestTestSuite() ctx := s.e.NewContext(nil, nil) txid := "ASPB5E72OT2UWSOCQGD5OPT3W4KV4LZZDL7L5MBCC3EBAIJCDHAA" s.e.Router().Find(http.MethodGet, "/v1/transactions/pending/"+txid, ctx) @@ -152,7 +160,8 @@ func (s *TestSuite) TestPendingTransactionID() { assert.Equal(s.T(), callsBefore+1, s.calls) } func (s *TestSuite) TestPendingTransactionInformationByAddress() { - partitiontest.PartitionTest(s.T()) + // partitiontest.PartitionTest(s.T()) + // Partitioning in TestTestSuite() ctx := s.e.NewContext(nil, nil) addr := "ZBBRQD73JH5KZ7XRED6GALJYJUXOMBBP3X2Z2XFA4LATV3MUJKKMKG7SHA" s.e.Router().Find(http.MethodGet, "/v1/account/"+addr+"/transactions/pending", ctx) @@ -165,7 +174,8 @@ func (s *TestSuite) TestPendingTransactionInformationByAddress() { assert.Equal(s.T(), callsBefore+1, s.calls) } func (s *TestSuite) TestGetAsset() { - partitiontest.PartitionTest(s.T()) + // partitiontest.PartitionTest(s.T()) + // Partitioning in TestTestSuite() ctx := s.e.NewContext(nil, nil) s.e.Router().Find(http.MethodGet, "/v1/asset/123456", ctx) assert.Equal(s.T(), "/v1/asset/:index", ctx.Path()) @@ -177,7 +187,8 @@ func (s *TestSuite) TestGetAsset() { assert.Equal(s.T(), callsBefore+1, s.calls) } func (s *TestSuite) TestGetTransactionByID() { - partitiontest.PartitionTest(s.T()) + // partitiontest.PartitionTest(s.T()) + // Partitioning in TestTestSuite() ctx := s.e.NewContext(nil, nil) txid := "ASPB5E72OT2UWSOCQGD5OPT3W4KV4LZZDL7L5MBCC3EBAIJCDHAA" s.e.Router().Find(http.MethodGet, "/v1/transaction/"+txid, ctx) @@ -190,5 +201,6 @@ func (s *TestSuite) TestGetTransactionByID() { assert.Equal(s.T(), callsBefore+1, s.calls) } func TestTestSuite(t *testing.T) { + partitiontest.PartitionTest(t) suite.Run(t, new(TestSuite)) } diff --git a/daemon/algod/api/server/v1/handlers/handlers_test.go b/daemon/algod/api/server/v1/handlers/handlers_test.go index 861d1767d4..8649efc4fa 100644 --- a/daemon/algod/api/server/v1/handlers/handlers_test.go +++ b/daemon/algod/api/server/v1/handlers/handlers_test.go @@ -25,10 +25,12 @@ import ( "github.com/algorand/go-algorand/data/transactions" "github.com/algorand/go-algorand/node" "github.com/algorand/go-algorand/protocol" + "github.com/algorand/go-algorand/test/partitiontest" "github.com/stretchr/testify/require" ) func TestDecorateUnknownTransactionTypeError(t *testing.T) { + partitiontest.PartitionTest(t) type TestCase struct { err error txn node.TxnWithStatus diff --git a/daemon/algod/api/server/v2/account_test.go b/daemon/algod/api/server/v2/account_test.go index f9bc836fb0..f7dd96d807 100644 --- a/daemon/algod/api/server/v2/account_test.go +++ b/daemon/algod/api/server/v2/account_test.go @@ -26,9 +26,11 @@ import ( "github.com/algorand/go-algorand/daemon/algod/api/server/v2/generated" "github.com/algorand/go-algorand/data/basics" "github.com/algorand/go-algorand/protocol" + "github.com/algorand/go-algorand/test/partitiontest" ) func TestAccount(t *testing.T) { + partitiontest.PartitionTest(t) proto := config.Consensus[protocol.ConsensusFuture] appIdx1 := basics.AppIndex(1) appIdx2 := basics.AppIndex(2) diff --git a/daemon/algod/api/server/v2/dryrun_test.go b/daemon/algod/api/server/v2/dryrun_test.go index 6bcf2c9051..1073feb4e8 100644 --- a/daemon/algod/api/server/v2/dryrun_test.go +++ b/daemon/algod/api/server/v2/dryrun_test.go @@ -131,6 +131,7 @@ var dryrunProtoVersion protocol.ConsensusVersion = protocol.ConsensusFuture var dryrunMakeLedgerProto protocol.ConsensusVersion = "dryrunMakeLedgerProto" func TestDryrunLogicSig(t *testing.T) { + partitiontest.PartitionTest(t) // {"txns":[{"lsig":{"l":"AiABASI="},"txn":{}}]} t.Parallel() @@ -155,6 +156,7 @@ func TestDryrunLogicSig(t *testing.T) { } func TestDryrunLogicSigSource(t *testing.T) { + partitiontest.PartitionTest(t) // {"txns":[{"lsig":{"l":"AiABASI="},"txn":{}}]} t.Parallel() @@ -386,6 +388,7 @@ func checkAppCallPass(t *testing.T, response *generated.DryrunResponse) { } func TestDryrunGlobal1(t *testing.T) { + partitiontest.PartitionTest(t) // {"txns":[{"lsig":{"l":"AiABASI="},"txn":{}}]} t.Parallel() @@ -434,6 +437,7 @@ func TestDryrunGlobal1(t *testing.T) { } func TestDryrunGlobal2(t *testing.T) { + partitiontest.PartitionTest(t) // {"txns":[{"lsig":{"l":"AiABASI="},"txn":{}}]} t.Parallel() @@ -486,6 +490,7 @@ func TestDryrunGlobal2(t *testing.T) { } func TestDryrunLocal1(t *testing.T) { + partitiontest.PartitionTest(t) // {"txns":[{"lsig":{"l":"AiABASI="},"txn":{}}]} t.Parallel() @@ -559,6 +564,7 @@ func TestDryrunLocal1(t *testing.T) { } func TestDryrunLocal1A(t *testing.T) { + partitiontest.PartitionTest(t) // {"txns":[{"lsig":{"l":"AiABASI="},"txn":{}}]} t.Parallel() @@ -639,6 +645,7 @@ func TestDryrunLocal1A(t *testing.T) { } func TestDryrunLocalCheck(t *testing.T) { + partitiontest.PartitionTest(t) // {"txns":[{"lsig":{"l":"AiABASI="},"txn":{}}]} t.Parallel() var dr DryrunRequest @@ -693,6 +700,7 @@ func TestDryrunLocalCheck(t *testing.T) { } func TestDryrunMultipleTxns(t *testing.T) { + partitiontest.PartitionTest(t) t.Parallel() var dr DryrunRequest @@ -740,6 +748,7 @@ func TestDryrunMultipleTxns(t *testing.T) { } func TestDryrunEncodeDecode(t *testing.T) { + partitiontest.PartitionTest(t) t.Parallel() var gdr generated.DryrunRequest @@ -844,6 +853,7 @@ func TestDryrunEncodeDecode(t *testing.T) { } func TestDryrunMakeLedger(t *testing.T) { + partitiontest.PartitionTest(t) t.Parallel() var dr DryrunRequest @@ -956,6 +966,7 @@ var dataJSON = []byte(`{ }`) func TestDryrunRequestJSON(t *testing.T) { + partitiontest.PartitionTest(t) t.Parallel() var gdr generated.DryrunRequest @@ -982,6 +993,7 @@ func TestDryrunRequestJSON(t *testing.T) { } func TestStateDeltaToStateDelta(t *testing.T) { + partitiontest.PartitionTest(t) t.Parallel() sd := basics.StateDelta{ "byteskey": { @@ -1032,6 +1044,7 @@ func randomAddress() basics.Address { } func TestDryrunOptIn(t *testing.T) { + partitiontest.PartitionTest(t) t.Parallel() ops, err := logic.AssembleString(`#pragma version 2 @@ -1095,6 +1108,7 @@ int 1`) } func TestDryrunLogs(t *testing.T) { + partitiontest.PartitionTest(t) t.Parallel() ops, err := logic.AssembleString(` diff --git a/daemon/algod/api/server/v2/test/handlers_test.go b/daemon/algod/api/server/v2/test/handlers_test.go index b5930e28a0..5d5c465dad 100644 --- a/daemon/algod/api/server/v2/test/handlers_test.go +++ b/daemon/algod/api/server/v2/test/handlers_test.go @@ -41,6 +41,7 @@ import ( "github.com/algorand/go-algorand/logging" "github.com/algorand/go-algorand/node" "github.com/algorand/go-algorand/protocol" + "github.com/algorand/go-algorand/test/partitiontest" "github.com/algorand/go-algorand/util/execpool" ) @@ -64,6 +65,7 @@ func setupTestForMethodGet(t *testing.T) (v2.Handlers, echo.Context, *httptest.R } func TestSimpleMockBuilding(t *testing.T) { + partitiontest.PartitionTest(t) t.Parallel() handler, _, _, _, _, releasefunc := setupTestForMethodGet(t) @@ -87,6 +89,7 @@ func accountInformationTest(t *testing.T, address string, expectedCode int) { } func TestAccountInformation(t *testing.T) { + partitiontest.PartitionTest(t) t.Parallel() accountInformationTest(t, poolAddr.String(), 200) @@ -102,6 +105,7 @@ func getBlockTest(t *testing.T, blockNum uint64, format string, expectedCode int } func TestGetBlock(t *testing.T) { + partitiontest.PartitionTest(t) t.Parallel() getBlockTest(t, 0, "json", 200) @@ -111,6 +115,7 @@ func TestGetBlock(t *testing.T) { } func TestGetBlockJsonEncoding(t *testing.T) { + partitiontest.PartitionTest(t) t.Parallel() handler, c, rec, _, _, releasefunc := setupTestForMethodGet(t) @@ -206,6 +211,7 @@ func TestGetBlockJsonEncoding(t *testing.T) { } func TestGetSupply(t *testing.T) { + partitiontest.PartitionTest(t) t.Parallel() handler, c, _, _, _, releasefunc := setupTestForMethodGet(t) @@ -215,6 +221,7 @@ func TestGetSupply(t *testing.T) { } func TestGetStatus(t *testing.T) { + partitiontest.PartitionTest(t) t.Parallel() handler, c, rec, _, _, releasefunc := setupTestForMethodGet(t) @@ -246,6 +253,7 @@ func TestGetStatus(t *testing.T) { } func TestGetStatusAfterBlock(t *testing.T) { + partitiontest.PartitionTest(t) t.Parallel() handler, c, rec, _, _, releasefunc := setupTestForMethodGet(t) @@ -258,6 +266,7 @@ func TestGetStatusAfterBlock(t *testing.T) { } func TestGetTransactionParams(t *testing.T) { + partitiontest.PartitionTest(t) t.Parallel() handler, c, rec, _, _, releasefunc := setupTestForMethodGet(t) @@ -281,6 +290,7 @@ func pendingTransactionInformationTest(t *testing.T, txidToUse int, format strin } func TestPendingTransactionInformation(t *testing.T) { + partitiontest.PartitionTest(t) t.Parallel() pendingTransactionInformationTest(t, 0, "json", 200) @@ -317,6 +327,7 @@ func getPendingTransactionsTest(t *testing.T, format string, max uint64, expecte } func TestPendingTransactions(t *testing.T) { + partitiontest.PartitionTest(t) t.Parallel() getPendingTransactionsTest(t, "json", 0, 200) @@ -344,6 +355,7 @@ func pendingTransactionsByAddressTest(t *testing.T, rootkeyToUse int, format str } func TestPendingTransactionsByAddress(t *testing.T) { + partitiontest.PartitionTest(t) t.Parallel() pendingTransactionsByAddressTest(t, 0, "json", 200) @@ -381,6 +393,7 @@ func postTransactionTest(t *testing.T, txnToUse, expectedCode int) { } func TestPostTransaction(t *testing.T) { + partitiontest.PartitionTest(t) t.Parallel() postTransactionTest(t, -1, 400) @@ -410,6 +423,7 @@ func startCatchupTest(t *testing.T, catchpoint string, nodeError error, expected } func TestStartCatchup(t *testing.T) { + partitiontest.PartitionTest(t) t.Parallel() goodCatchPoint := "5894690#DVFRZUYHEFKRLK5N6DNJRR4IABEVN2D6H76F3ZSEPIE6MKXMQWQA" @@ -450,6 +464,7 @@ func abortCatchupTest(t *testing.T, catchpoint string, expectedCode int) { } func TestAbortCatchup(t *testing.T) { + partitiontest.PartitionTest(t) t.Parallel() goodCatchPoint := "5894690#DVFRZUYHEFKRLK5N6DNJRR4IABEVN2D6H76F3ZSEPIE6MKXMQWQA" @@ -482,6 +497,7 @@ func tealCompileTest(t *testing.T, bytesToUse []byte, expectedCode int, enableDe } func TestTealCompile(t *testing.T) { + partitiontest.PartitionTest(t) t.Parallel() tealCompileTest(t, nil, 200, true) // nil program should work @@ -543,6 +559,7 @@ func tealDryrunTest( } func TestTealDryrun(t *testing.T) { + partitiontest.PartitionTest(t) t.Parallel() var gdr generated.DryrunRequest diff --git a/data/committee/sortition/sortition_test.go b/data/committee/sortition/sortition_test.go index 2d19bd746b..ac3eae0191 100644 --- a/data/committee/sortition/sortition_test.go +++ b/data/committee/sortition/sortition_test.go @@ -21,6 +21,7 @@ import ( "testing" "github.com/algorand/go-algorand/crypto" + "github.com/algorand/go-algorand/test/partitiontest" ) func BenchmarkSortition(b *testing.B) { @@ -36,6 +37,7 @@ func BenchmarkSortition(b *testing.B) { } func TestSortitionBasic(t *testing.T) { + partitiontest.PartitionTest(t) hitcount := uint64(0) const N = 1000 const expectedSize = 20 diff --git a/data/transactions/logic/assembler_test.go b/data/transactions/logic/assembler_test.go index 46bc84ba6f..6f7525c033 100644 --- a/data/transactions/logic/assembler_test.go +++ b/data/transactions/logic/assembler_test.go @@ -1397,6 +1397,7 @@ func TestConstantDisassembly(t *testing.T) { } func TestConstantArgs(t *testing.T) { + partitiontest.PartitionTest(t) t.Parallel() for v := uint64(1); v <= AssemblerMaxVersion; v++ { testProg(t, "int", v, expect{1, "int needs one argument"}) @@ -2142,6 +2143,7 @@ flip: // [x] } func TestSwapTypeCheck(t *testing.T) { + partitiontest.PartitionTest(t) t.Parallel() /* reconfirm that we detect this type error */ testProg(t, "int 1; byte 0x1234; +", AssemblerMaxVersion, expect{3, "+ arg 1..."}) @@ -2151,6 +2153,7 @@ func TestSwapTypeCheck(t *testing.T) { } func TestDigAsm(t *testing.T) { + partitiontest.PartitionTest(t) t.Parallel() testProg(t, "int 1; dig; +", AssemblerMaxVersion, expect{2, "dig expects 1 immediate..."}) testProg(t, "int 1; dig junk; +", AssemblerMaxVersion, expect{2, "...invalid syntax..."}) @@ -2170,6 +2173,7 @@ func TestDigAsm(t *testing.T) { } func TestEqualsTypeCheck(t *testing.T) { + partitiontest.PartitionTest(t) t.Parallel() testProg(t, "int 1; byte 0x1234; ==", AssemblerMaxVersion, expect{3, "== arg 0..."}) testProg(t, "int 1; byte 0x1234; !=", AssemblerMaxVersion, expect{3, "!= arg 0..."}) @@ -2178,6 +2182,7 @@ func TestEqualsTypeCheck(t *testing.T) { } func TestDupTypeCheck(t *testing.T) { + partitiontest.PartitionTest(t) t.Parallel() testProg(t, "byte 0x1234; dup; int 1; +", AssemblerMaxVersion, expect{4, "+ arg 0..."}) testProg(t, "byte 0x1234; int 1; dup; +", AssemblerMaxVersion) @@ -2192,18 +2197,21 @@ func TestDupTypeCheck(t *testing.T) { } func TestSelectTypeCheck(t *testing.T) { + partitiontest.PartitionTest(t) t.Parallel() testProg(t, "int 1; int 2; int 3; select; len", AssemblerMaxVersion, expect{5, "len arg 0..."}) testProg(t, "byte 0x1234; byte 0x5678; int 3; select; !", AssemblerMaxVersion, expect{5, "! arg 0..."}) } func TestSetBitTypeCheck(t *testing.T) { + partitiontest.PartitionTest(t) t.Parallel() testProg(t, "int 1; int 2; int 3; setbit; len", AssemblerMaxVersion, expect{5, "len arg 0..."}) testProg(t, "byte 0x1234; int 2; int 3; setbit; !", AssemblerMaxVersion, expect{5, "! arg 0..."}) } func TestCoverAsm(t *testing.T) { + partitiontest.PartitionTest(t) t.Parallel() testProg(t, `int 4; byte "john"; int 5; cover 2; pop; +`, AssemblerMaxVersion) testProg(t, `int 4; byte "ayush"; int 5; cover 1; pop; +`, AssemblerMaxVersion) @@ -2212,6 +2220,7 @@ func TestCoverAsm(t *testing.T) { } func TestUncoverAsm(t *testing.T) { + partitiontest.PartitionTest(t) t.Parallel() testProg(t, `int 4; byte "john"; int 5; uncover 2; +`, AssemblerMaxVersion) testProg(t, `int 4; byte "ayush"; int 5; uncover 1; pop; +`, AssemblerMaxVersion) diff --git a/data/transactions/logic/doc_test.go b/data/transactions/logic/doc_test.go index ad87f4a010..6f9bf329c4 100644 --- a/data/transactions/logic/doc_test.go +++ b/data/transactions/logic/doc_test.go @@ -96,6 +96,8 @@ func TestOpImmediateNote(t *testing.T) { } func TestAllImmediatesDocumented(t *testing.T) { + partitiontest.PartitionTest(t) + for _, op := range OpSpecs { count := len(op.Details.Immediates) note := OpImmediateNote(op.Name) diff --git a/data/transactions/logic/evalStateful_test.go b/data/transactions/logic/evalStateful_test.go index f782fcce9a..e9f4ac1c7b 100644 --- a/data/transactions/logic/evalStateful_test.go +++ b/data/transactions/logic/evalStateful_test.go @@ -1490,6 +1490,7 @@ intc_1 } func TestAppParams(t *testing.T) { + partitiontest.PartitionTest(t) t.Parallel() ep, ledger := makeSampleEnv() ledger.newAccount(ep.Txn.Txn.Sender, 1) diff --git a/data/transactions/logic/eval_test.go b/data/transactions/logic/eval_test.go index c6330032c2..bf15f3f415 100644 --- a/data/transactions/logic/eval_test.go +++ b/data/transactions/logic/eval_test.go @@ -2140,6 +2140,7 @@ len`, 2) } func TestExtractOp(t *testing.T) { + partitiontest.PartitionTest(t) t.Parallel() testAccepts(t, "byte 0x123456789abc; extract 1 2; byte 0x3456; ==", 5) testAccepts(t, "byte 0x123456789abc; extract 0 6; byte 0x123456789abc; ==", 5) @@ -2156,6 +2157,7 @@ func TestExtractOp(t *testing.T) { } func TestExtractFlop(t *testing.T) { + partitiontest.PartitionTest(t) t.Parallel() // fails in compiler testProg(t, `byte 0xf000000000000000 @@ -4355,6 +4357,7 @@ func TestBytes(t *testing.T) { } func TestMethod(t *testing.T) { + partitiontest.PartitionTest(t) t.Parallel() // Although 'method' is new around the time of v5, it is a // pseudo-op, so it's ok to use it earlier, as it compiles to @@ -4391,6 +4394,7 @@ func TestDig(t *testing.T) { } func TestCover(t *testing.T) { + partitiontest.PartitionTest(t) t.Parallel() testAccepts(t, "int 4; int 3; int 2; int 1; cover 0; int 1; ==; return", 5) testAccepts(t, "int 4; int 3; int 2; int 1; cover 1; int 2; ==; return", 5) @@ -4401,6 +4405,7 @@ func TestCover(t *testing.T) { } func TestUncover(t *testing.T) { + partitiontest.PartitionTest(t) t.Parallel() testAccepts(t, "int 4; int 3; int 2; int 1; uncover 0; int 1; ==; return", 5) testAccepts(t, "int 4; int 3; int 2; int 1; uncover 2; int 3; ==; return", 5) diff --git a/data/transactions/logic/fields_test.go b/data/transactions/logic/fields_test.go index e88f3820f6..5e16894aaa 100644 --- a/data/transactions/logic/fields_test.go +++ b/data/transactions/logic/fields_test.go @@ -27,6 +27,7 @@ import ( ) func TestArrayFields(t *testing.T) { + partitiontest.PartitionTest(t) require.Equal(t, len(TxnaFieldNames), len(TxnaFieldTypes)) require.Equal(t, len(txnaFieldSpecByField), len(TxnaFieldTypes)) } diff --git a/data/transactions/logic/opcodes_test.go b/data/transactions/logic/opcodes_test.go index c894e12478..b5e7627850 100644 --- a/data/transactions/logic/opcodes_test.go +++ b/data/transactions/logic/opcodes_test.go @@ -81,7 +81,8 @@ func TestOpcodesByVersionReordered(t *testing.T) { } func TestOpcodesByVersion(t *testing.T) { - partitiontest.PartitionTest(t) + // partitiontest.PartitionTest(t) + // has partitioning in the TestOpcodesByVersionReordered() // Make a copy of the OpSpecs to check if OpcodesByVersion will change it OpSpecs2 := make([]OpSpec, len(OpSpecs)) diff --git a/debug/logfilter/main_test.go b/debug/logfilter/main_test.go index 963e28c348..a680073744 100644 --- a/debug/logfilter/main_test.go +++ b/debug/logfilter/main_test.go @@ -25,10 +25,12 @@ import ( "strings" "testing" + "github.com/algorand/go-algorand/test/partitiontest" "github.com/stretchr/testify/require" ) func TestLogFilterExamples(t *testing.T) { + partitiontest.PartitionTest(t) // iterate on all the example files in the local directory. exampleFiles := []string{} filepath.Walk(".", func(path string, info os.FileInfo, err error) error { diff --git a/gen/generate_test.go b/gen/generate_test.go index c8a6656d80..8b1c90e437 100644 --- a/gen/generate_test.go +++ b/gen/generate_test.go @@ -30,6 +30,7 @@ import ( "github.com/algorand/go-algorand/protocol" "github.com/algorand/go-algorand/util/db" + "github.com/algorand/go-algorand/test/partitiontest" "github.com/stretchr/testify/require" ) @@ -105,6 +106,7 @@ func TestLoadSingleRootKeyConcurrent(t *testing.T) { } func TestGenesisRoundoff(t *testing.T) { + partitiontest.PartitionTest(t) verbosity := strings.Builder{} genesisData := DefaultGenesis genesisData.NetworkName = "wat" diff --git a/ledger/persistedaccts_list_test.go b/ledger/persistedaccts_list_test.go index 14860d27d2..95b8b026dd 100644 --- a/ledger/persistedaccts_list_test.go +++ b/ledger/persistedaccts_list_test.go @@ -17,8 +17,10 @@ package ledger import ( - "github.com/algorand/go-algorand/data/basics" "testing" + + "github.com/algorand/go-algorand/data/basics" + "github.com/algorand/go-algorand/test/partitiontest" ) func checkLen(list *persistedAccountDataList) int { @@ -36,6 +38,7 @@ func countListSize(head *persistedAccountDataListNode) (counter int) { } func TestRemoveFromList(t *testing.T) { + partitiontest.PartitionTest(t) l := newPersistedAccountList() e1 := l.pushFront(&persistedAccountData{addr: basics.Address{1}}) e2 := l.pushFront(&persistedAccountData{addr: basics.Address{2}}) @@ -49,6 +52,7 @@ func TestRemoveFromList(t *testing.T) { } func TestAddingNewNodeWithAllocatedFreeList(t *testing.T) { + partitiontest.PartitionTest(t) l := newPersistedAccountList().allocateFreeNodes(10) checkListPointers(t, l, []*persistedAccountDataListNode{}) if countListSize(l.freeList) != 10 { @@ -122,6 +126,7 @@ func pointerInspection(t *testing.T, es []*persistedAccountDataListNode, root *p } func TestMultielementListPositioning(t *testing.T) { + partitiontest.PartitionTest(t) l := newPersistedAccountList() checkListPointers(t, l, []*persistedAccountDataListNode{}) // test elements @@ -180,6 +185,7 @@ func TestMultielementListPositioning(t *testing.T) { } func TestSingleElementListPositioning(t *testing.T) { + partitiontest.PartitionTest(t) l := newPersistedAccountList() checkListPointers(t, l, []*persistedAccountDataListNode{}) e := l.pushFront(&persistedAccountData{addr: basics.Address{1}}) @@ -191,6 +197,7 @@ func TestSingleElementListPositioning(t *testing.T) { } func TestRemovedNodeShouldBeMovedToFreeList(t *testing.T) { + partitiontest.PartitionTest(t) l := newPersistedAccountList() e1 := l.pushFront(&persistedAccountData{addr: basics.Address{1}}) e2 := l.pushFront(&persistedAccountData{addr: basics.Address{2}}) diff --git a/ledger/txtail_test.go b/ledger/txtail_test.go index 97d5a5cbba..9d5d1c2bf9 100644 --- a/ledger/txtail_test.go +++ b/ledger/txtail_test.go @@ -147,6 +147,7 @@ func makeTxTailTestTransaction(r basics.Round, txnIdx int) (txn transactions.Sig } func TestTxTailLoadFromDisk(t *testing.T) { + partitiontest.PartitionTest(t) var ledger txTailTestLedger txtail := txTail{} diff --git a/libgoal/libgoal_test.go b/libgoal/libgoal_test.go index 53274e0db5..5d0959fbeb 100644 --- a/libgoal/libgoal_test.go +++ b/libgoal/libgoal_test.go @@ -19,10 +19,12 @@ package libgoal import ( "testing" + "github.com/algorand/go-algorand/test/partitiontest" "github.com/stretchr/testify/require" ) func TestValidRounds(t *testing.T) { + partitiontest.PartitionTest(t) t.Parallel() a := require.New(t) diff --git a/logging/cyclicWriter_test.go b/logging/cyclicWriter_test.go index 9a33d5337f..e3ea895304 100644 --- a/logging/cyclicWriter_test.go +++ b/logging/cyclicWriter_test.go @@ -21,10 +21,12 @@ import ( "os" "testing" + "github.com/algorand/go-algorand/test/partitiontest" "github.com/stretchr/testify/require" ) func TestCyclicWrite(t *testing.T) { + partitiontest.PartitionTest(t) liveFileName := "live.test" archiveFileName := "archive.test" defer os.Remove(liveFileName) diff --git a/logging/logBuffer_test.go b/logging/logBuffer_test.go index 6a9b8fe840..9c0fba8b9a 100644 --- a/logging/logBuffer_test.go +++ b/logging/logBuffer_test.go @@ -22,6 +22,7 @@ import ( "io" "testing" + "github.com/algorand/go-algorand/test/partitiontest" "github.com/stretchr/testify/require" ) @@ -46,11 +47,13 @@ func createFixture(maxDepth uint) logBufferTestFixture { } func TestLogBufferEmpty(t *testing.T) { + partitiontest.PartitionTest(t) fixture := createFixture(10) require.Equal(t, "", fixture.lb.string()) } func TestLogBufferString(t *testing.T) { + partitiontest.PartitionTest(t) fixture := createFixture(10) lb := fixture.lb w := fixture.w @@ -62,6 +65,7 @@ func TestLogBufferString(t *testing.T) { } func TestLogBufferStrings(t *testing.T) { + partitiontest.PartitionTest(t) fixture := createFixture(10) w := fixture.w fmt.Fprint(w, testString1) @@ -75,6 +79,7 @@ func TestLogBufferStrings(t *testing.T) { } func TestLogBufferZeroMaxDepth(t *testing.T) { + partitiontest.PartitionTest(t) fixture := createFixture(0) w := fixture.w fmt.Fprint(w, testString1) @@ -86,6 +91,7 @@ func TestLogBufferZeroMaxDepth(t *testing.T) { } func TestLogBufferMaxDepth(t *testing.T) { + partitiontest.PartitionTest(t) fixture := createFixture(2) w := fixture.w fmt.Fprint(w, testString1) @@ -101,6 +107,7 @@ func TestLogBufferMaxDepth(t *testing.T) { } func TestLogBufferTrim(t *testing.T) { + partitiontest.PartitionTest(t) maxDepth := uint(9) entryCount := maxDepth + 2 lb := createLogBuffer(maxDepth) diff --git a/logging/log_test.go b/logging/log_test.go index c4142fb019..363791be1a 100644 --- a/logging/log_test.go +++ b/logging/log_test.go @@ -21,6 +21,7 @@ import ( "encoding/json" "testing" + "github.com/algorand/go-algorand/test/partitiontest" "github.com/stretchr/testify/require" ) @@ -42,6 +43,7 @@ func isJSON(s string) bool { } func TestFileOutputNewLogger(t *testing.T) { + partitiontest.PartitionTest(t) a := require.New(t) // Create a buffer (mimics a file) for the output @@ -59,6 +61,7 @@ func TestFileOutputNewLogger(t *testing.T) { } func TestSetLevelNewLogger(t *testing.T) { + partitiontest.PartitionTest(t) a := require.New(t) //Create a buffer (mimics a file) for the output @@ -79,6 +82,7 @@ func TestSetLevelNewLogger(t *testing.T) { } func TestWithFieldsNewLogger(t *testing.T) { + partitiontest.PartitionTest(t) a := require.New(t) // Create a buffer (mimics a file) for the output @@ -93,6 +97,7 @@ func TestWithFieldsNewLogger(t *testing.T) { } func TestSetJSONFormatter(t *testing.T) { + partitiontest.PartitionTest(t) a := require.New(t) // Create a buffer (mimics a file) for the output diff --git a/logging/telemetryConfig_test.go b/logging/telemetryConfig_test.go index 6e040d1460..28cfef6136 100644 --- a/logging/telemetryConfig_test.go +++ b/logging/telemetryConfig_test.go @@ -23,10 +23,12 @@ import ( "path/filepath" "testing" + "github.com/algorand/go-algorand/test/partitiontest" "github.com/stretchr/testify/require" ) func Test_loadTelemetryConfig(t *testing.T) { + partitiontest.PartitionTest(t) sample := TelemetryConfig{ Enable: true, @@ -58,6 +60,7 @@ func Test_loadTelemetryConfig(t *testing.T) { } func Test_CreateSaveLoadTelemetryConfig(t *testing.T) { + partitiontest.PartitionTest(t) testDir := os.Getenv("TESTDIR") @@ -92,6 +95,7 @@ func Test_CreateSaveLoadTelemetryConfig(t *testing.T) { } func Test_SanitizeTelemetryString(t *testing.T) { + partitiontest.PartitionTest(t) type testcase struct { input string expected string @@ -110,6 +114,7 @@ func Test_SanitizeTelemetryString(t *testing.T) { } func TestLoadTelemetryConfig(t *testing.T) { + partitiontest.PartitionTest(t) testLoggingConfigFileName := "../test/testdata/configs/logging/logging.config.test1" tc, err := loadTelemetryConfig(testLoggingConfigFileName) require.NoError(t, err) @@ -122,7 +127,7 @@ func TestLoadTelemetryConfig(t *testing.T) { } func TestLoadTelemetryConfigBlankUsernamePassword(t *testing.T) { - + partitiontest.PartitionTest(t) testLoggingConfigFileName := "../test/testdata/configs/logging/logging.config.test2" tc, err := loadTelemetryConfig(testLoggingConfigFileName) require.NoError(t, err) @@ -133,6 +138,7 @@ func TestLoadTelemetryConfigBlankUsernamePassword(t *testing.T) { } func TestSaveTelemetryConfigBlankUsernamePassword(t *testing.T) { + partitiontest.PartitionTest(t) testDir := os.Getenv("TESTDIR") diff --git a/logging/telemetry_test.go b/logging/telemetry_test.go index fce2e6d9e1..039ddf4f0d 100644 --- a/logging/telemetry_test.go +++ b/logging/telemetry_test.go @@ -29,6 +29,7 @@ import ( "github.com/algorand/go-algorand/config" "github.com/algorand/go-algorand/logging/telemetryspec" + "github.com/algorand/go-algorand/test/partitiontest" ) type mockTelemetryHook struct { @@ -133,6 +134,7 @@ func (h *mockTelemetryHook) entries() []string { } func TestCreateHookError(t *testing.T) { + partitiontest.PartitionTest(t) a := require.New(t) cfg := createTelemetryConfig() @@ -147,6 +149,7 @@ func TestCreateHookError(t *testing.T) { } func TestTelemetryHook(t *testing.T) { + partitiontest.PartitionTest(t) a := require.New(t) f := makeTelemetryTestFixture(logrus.InfoLevel) @@ -169,6 +172,7 @@ func TestTelemetryHook(t *testing.T) { } func TestNilMetrics(t *testing.T) { + partitiontest.PartitionTest(t) a := require.New(t) f := makeTelemetryTestFixture(logrus.InfoLevel) @@ -178,6 +182,7 @@ func TestNilMetrics(t *testing.T) { } func TestMultipleOperationStop(t *testing.T) { + partitiontest.PartitionTest(t) a := require.New(t) f := makeTelemetryTestFixture(logrus.InfoLevel) @@ -194,6 +199,7 @@ func TestMultipleOperationStop(t *testing.T) { } func TestDetails(t *testing.T) { + partitiontest.PartitionTest(t) a := require.New(t) f := makeTelemetryTestFixture(logrus.InfoLevel) @@ -216,6 +222,7 @@ func (m testMetrics) Identifier() telemetryspec.Metric { } func TestMetrics(t *testing.T) { + partitiontest.PartitionTest(t) a := require.New(t) f := makeTelemetryTestFixture(logrus.InfoLevel) @@ -231,6 +238,7 @@ func TestMetrics(t *testing.T) { } func TestLogHook(t *testing.T) { + partitiontest.PartitionTest(t) a := require.New(t) f := makeTelemetryTestFixture(logrus.InfoLevel) @@ -248,6 +256,7 @@ func TestLogHook(t *testing.T) { } func TestLogLevels(t *testing.T) { + partitiontest.PartitionTest(t) runLogLevelsTest(t, logrus.DebugLevel, 7) runLogLevelsTest(t, logrus.InfoLevel, 6) runLogLevelsTest(t, logrus.WarnLevel, 5) @@ -281,6 +290,7 @@ func runLogLevelsTest(t *testing.T, minLevel logrus.Level, expected int) { } func TestLogHistoryLevels(t *testing.T) { + partitiontest.PartitionTest(t) a := require.New(t) cfg := createTelemetryConfig() cfg.MinLogLevel = logrus.DebugLevel @@ -320,6 +330,7 @@ func TestLogHistoryLevels(t *testing.T) { } func TestReadTelemetryConfigOrDefaultNoDataDir(t *testing.T) { + partitiontest.PartitionTest(t) a := require.New(t) tempDir := os.TempDir() originalGlobalConfigFileRoot, _ := config.GetGlobalConfigFileRoot() diff --git a/logging/telemetryhook_test.go b/logging/telemetryhook_test.go index c60275f95f..083df03c53 100644 --- a/logging/telemetryhook_test.go +++ b/logging/telemetryhook_test.go @@ -26,9 +26,11 @@ import ( "github.com/stretchr/testify/require" "github.com/algorand/go-algorand/config" + "github.com/algorand/go-algorand/test/partitiontest" ) func TestTelemetryConfig(t *testing.T) { + partitiontest.PartitionTest(t) a := require.New(t) cfg := createTelemetryConfig() @@ -41,6 +43,7 @@ func TestTelemetryConfig(t *testing.T) { } func TestLoadDefaultConfig(t *testing.T) { + partitiontest.PartitionTest(t) a := require.New(t) configDir, err := ioutil.TempDir("", "testdir") @@ -64,6 +67,7 @@ func isDefault(cfg TelemetryConfig) bool { } func TestLoggingConfigDataDirFirst(t *testing.T) { + partitiontest.PartitionTest(t) a := require.New(t) globalConfigRoot, err := ioutil.TempDir("", "globalConfigRoot") @@ -108,6 +112,7 @@ func TestLoggingConfigDataDirFirst(t *testing.T) { } func TestLoggingConfigGlobalSecond(t *testing.T) { + partitiontest.PartitionTest(t) a := require.New(t) globalConfigRoot, err := ioutil.TempDir("", "globalConfigRoot") @@ -139,6 +144,7 @@ func TestLoggingConfigGlobalSecond(t *testing.T) { } func TestSaveLoadConfig(t *testing.T) { + partitiontest.PartitionTest(t) a := require.New(t) globalConfigRoot, err := ioutil.TempDir("", "globalConfigRoot") @@ -170,6 +176,7 @@ func TestSaveLoadConfig(t *testing.T) { } func TestAsyncTelemetryHook_CloseDrop(t *testing.T) { + partitiontest.PartitionTest(t) const entryCount = 100 filling := make(chan struct{}) @@ -195,6 +202,7 @@ func TestAsyncTelemetryHook_CloseDrop(t *testing.T) { } func TestAsyncTelemetryHook_QueueDepth(t *testing.T) { + partitiontest.PartitionTest(t) const entryCount = 100 const maxDepth = 10 diff --git a/logging/telemetryspec/metric_test.go b/logging/telemetryspec/metric_test.go index 3f1aceef5e..0e096e72b0 100644 --- a/logging/telemetryspec/metric_test.go +++ b/logging/telemetryspec/metric_test.go @@ -21,10 +21,12 @@ import ( "testing" "time" + "github.com/algorand/go-algorand/test/partitiontest" "github.com/stretchr/testify/require" ) func TestTransactionProcessingTimeDistibutionFormatting(t *testing.T) { + partitiontest.PartitionTest(t) var processingTime transactionProcessingTimeDistibution processingTime.AddTransaction(50000 * time.Nanosecond) processingTime.AddTransaction(80000 * time.Nanosecond) diff --git a/network/wsNetwork_test.go b/network/wsNetwork_test.go index e19d20a848..d1d719b362 100644 --- a/network/wsNetwork_test.go +++ b/network/wsNetwork_test.go @@ -2053,6 +2053,7 @@ type urlCase struct { } func TestParseHostOrURL(t *testing.T) { + partitiontest.PartitionTest(t) urlTestCases := []urlCase{ {"localhost:123", url.URL{Scheme: "http", Host: "localhost:123"}}, {"http://localhost:123", url.URL{Scheme: "http", Host: "localhost:123"}}, diff --git a/scripts/buildtools/check_tests.py b/scripts/buildtools/check_tests.py new file mode 100755 index 0000000000..d34bb70389 --- /dev/null +++ b/scripts/buildtools/check_tests.py @@ -0,0 +1,116 @@ +print("===== STARTED RUNNING check_tests.py =====\n") + +import json +import sys +import argparse + +# Arguments parsing / help menu +parser = argparse.ArgumentParser(description='Check test results for intentionally and unintentionally skipped tests, as well as tests that ran multiple times.') +parser.add_argument('tests_results_filepath', metavar='RESULTS_FILE', + help='json format test results file path (e.g. /tmp/results/testresults.json)') +args = parser.parse_args() + +# Go through the given file one json object at a time, and record into a dict +AllTestResults = {} +with open(args.tests_results_filepath) as f: + for jsonObj in f: + testDict = json.loads(jsonObj) + if 'Test' not in testDict: + continue + + fullTestName = testDict['Package'] + ' ' + testDict['Test'] + if fullTestName not in AllTestResults: + AllTestResults[fullTestName] = {} + AllTestResults[fullTestName]['ran'] = 0 + AllTestResults[fullTestName]['last_output'] = '' + AllTestResults[fullTestName]['skipped_intentionally'] = False + AllTestResults[fullTestName]['skipped_reason'] = '' + + # actions can be: output, run, skip, pass + if 'pass' in testDict["Action"]: + AllTestResults[fullTestName]['ran'] += 1 + elif 'output' in testDict["Action"]: + if '--- SKIP' in testDict['Output'] and 'due to partitioning' not in AllTestResults[fullTestName]['last_output']: + AllTestResults[fullTestName]['skipped_intentionally'] = True + if '=== RUN' in AllTestResults[fullTestName]['last_output']: + AllTestResults[fullTestName]['skipped_reason'] = 'No reason given. PLEASE CHECK!!!' + else: + AllTestResults[fullTestName]['skipped_reason'] = AllTestResults[fullTestName]['last_output'].strip() + + AllTestResults[fullTestName]['last_output'] = testDict['Output'] + + + +f.close() + +# === Calculate results === + +# Sort and print messages with colored prefix +RED_TEXT_COLOR = "\033[0;31m" +GREEN_TEXT_COLOR = "\033[0;32m" +YELLOW_TEXT_COLOR = "\033[0;33m" +NORMAL_TEXT_COLOR = "\033[0;0m" +def printColor(message, color=NORMAL_TEXT_COLOR): + print(f"{color}{message}{NORMAL_TEXT_COLOR}") + +# Record error message for sys.exit(errorMessage) +errorMessage = '' + +# Check for tests that ran multiple times +printColor("=========== RAN MULTIPLE TIMES ===================", YELLOW_TEXT_COLOR) +listOfMultipleRuns = [] +for x in AllTestResults: + if AllTestResults[x]['ran'] > 1: + listOfMultipleRuns.append(x + " -- ran " + str(AllTestResults[x]['ran']) + " times. (Can probably be fixed by adding \"partitiontest.PartitionTest()\")") +countMultipleRuns = len(listOfMultipleRuns) +if countMultipleRuns: + printColor(f"The above {countMultipleRuns} tests ran multiple times:", RED_TEXT_COLOR) + [printColor(f"{x}", RED_TEXT_COLOR) for x in sorted(listOfMultipleRuns)] + printColor(f"The above {countMultipleRuns} tests ran multiple times:", RED_TEXT_COLOR) +else: + printColor("All tests that ran, ran only once ... OK", GREEN_TEXT_COLOR) +printColor("==================================================\n", YELLOW_TEXT_COLOR) + +# Check intentionally skipped tests +printColor("============= INTENTIONALLY SKIPPED ==============", YELLOW_TEXT_COLOR) +listOfSkippedIntentionally = [] +[listOfSkippedIntentionally.append(x) for x in AllTestResults if (AllTestResults[x]['ran'] == 0 and AllTestResults[x]['skipped_intentionally'] == True )] +countSkippedIntentionally = len(listOfSkippedIntentionally) +if countSkippedIntentionally: + printColor(f"The following {countSkippedIntentionally} tests were skipped intentionally:", YELLOW_TEXT_COLOR) + [printColor(f"{x} -- skipped intentionally (please double check) Reason: {AllTestResults[x]['skipped_reason']}", YELLOW_TEXT_COLOR) for x in sorted(listOfSkippedIntentionally)] + printColor(f"The above {countSkippedIntentionally} tests were skipped intentionally:", YELLOW_TEXT_COLOR) +else: + printColor("No tests skipped intentionally.", GREEN_TEXT_COLOR) +printColor("==================================================\n", YELLOW_TEXT_COLOR) + +# Check unintentionally skipped tests (due to partition) +printColor("============= UNINTENTIONALLY SKIPPED ============", YELLOW_TEXT_COLOR) +listOfSkippedUnintentionally = [] +[listOfSkippedUnintentionally.append(x) for x in AllTestResults if (AllTestResults[x]['ran'] == 0 and AllTestResults[x]['skipped_intentionally'] == False)] +countSkippedUnintentionally = len(listOfSkippedUnintentionally) +if countSkippedUnintentionally: + printColor(f"{countSkippedUnintentionally} tests were skipped unintentionally", RED_TEXT_COLOR) + [printColor(f"{x} -- skipped unintentionally. (due to partitiontest.PartitionTest() being called twice?)", RED_TEXT_COLOR) for x in sorted(listOfSkippedUnintentionally)] + printColor(f"{countSkippedUnintentionally} tests were skipped unintentionally.", RED_TEXT_COLOR) + errorMessage += f"{countSkippedUnintentionally} tests were skipped unintentionally"; +else: + printColor("No tests skipped unintentionally (due to partitioning).", GREEN_TEXT_COLOR) +printColor("==================================================\n", YELLOW_TEXT_COLOR) + +# === Summary === +printColor("==================== SUMMARY =====================", YELLOW_TEXT_COLOR) +countUniqueTests = len(AllTestResults) +countTotalSkipped = countSkippedIntentionally + countSkippedUnintentionally +countRanTests = sum(1 for x in AllTestResults if AllTestResults[x]['ran'] > 0) + +printColor(f"Saw {countUniqueTests} unique tests", GREEN_TEXT_COLOR if countUniqueTests != 0 else RED_TEXT_COLOR) +printColor(f"{countTotalSkipped} total skipped tests", GREEN_TEXT_COLOR if countTotalSkipped == 0 else YELLOW_TEXT_COLOR) +printColor(f"{countRanTests} tests ran", GREEN_TEXT_COLOR if countRanTests != 0 else RED_TEXT_COLOR) +printColor(f"{countSkippedIntentionally} tests were skipped intentionally. (They were probably disabled, please double check)", GREEN_TEXT_COLOR if countSkippedIntentionally == 0 else YELLOW_TEXT_COLOR) +printColor(f"{countSkippedUnintentionally} tests were skipped unintentionally. (Due to partitioning multiple times? maybe due to partitiontest.PartitionTest() being called twice?)", GREEN_TEXT_COLOR if countSkippedUnintentionally == 0 else RED_TEXT_COLOR) +printColor(f"{countMultipleRuns} tests ran multiple times. (Can probably be fixed by adding \"partitiontest.PartitionTest()\")", GREEN_TEXT_COLOR if countMultipleRuns == 0 else RED_TEXT_COLOR) +printColor("==================================================\n", YELLOW_TEXT_COLOR) + +print("===== FINISHED RUNNING check_tests.py =====") +sys.exit(0 if not errorMessage else errorMessage) diff --git a/test/e2e-go/cli/algod/expect/algod_expect_test.go b/test/e2e-go/cli/algod/expect/algod_expect_test.go index d7201b3f18..a5793200ab 100644 --- a/test/e2e-go/cli/algod/expect/algod_expect_test.go +++ b/test/e2e-go/cli/algod/expect/algod_expect_test.go @@ -19,10 +19,12 @@ import ( "testing" "github.com/algorand/go-algorand/test/framework/fixtures" + "github.com/algorand/go-algorand/test/partitiontest" ) // TestAlgodWithExpect Process all expect script files with suffix Test.exp within the test/e2e-go/cli/algod/expect directory func TestAlgodWithExpect(t *testing.T) { + partitiontest.PartitionTest(t) et := fixtures.MakeExpectTest(t) et.Run() } diff --git a/test/e2e-go/cli/algoh/expect/algoh_expect_test.go b/test/e2e-go/cli/algoh/expect/algoh_expect_test.go index 682183c495..5d9dbd2ecd 100644 --- a/test/e2e-go/cli/algoh/expect/algoh_expect_test.go +++ b/test/e2e-go/cli/algoh/expect/algoh_expect_test.go @@ -23,6 +23,8 @@ import ( // TestAlgohWithExpect Process all expect script files with suffix Test.exp within the test/e2e-go/cli/algoh/expect directory func TestAlgohWithExpect(t *testing.T) { + // partitiontest.PartitionTest(t) + // Causes double partition, so commented out on purpose et := fixtures.MakeExpectTest(t) et.Run() } diff --git a/test/e2e-go/cli/goal/expect/goal_expect_test.go b/test/e2e-go/cli/goal/expect/goal_expect_test.go index ce22987f07..eca9923f97 100644 --- a/test/e2e-go/cli/goal/expect/goal_expect_test.go +++ b/test/e2e-go/cli/goal/expect/goal_expect_test.go @@ -24,6 +24,8 @@ import ( // TestGoalWithExpect Process all expect script files with suffix Test.exp within the test/e2e-go/cli/goal/expect directory func TestGoalWithExpect(t *testing.T) { + // partitiontest.PartitionTest(t) + // Causes double partition, so commented out on purpose et := fixtures.MakeExpectTest(t) et.Run() } diff --git a/test/e2e-go/cli/tealdbg/expect/tealdbg_expect_test.go b/test/e2e-go/cli/tealdbg/expect/tealdbg_expect_test.go index 633e8f133e..0068b90a25 100644 --- a/test/e2e-go/cli/tealdbg/expect/tealdbg_expect_test.go +++ b/test/e2e-go/cli/tealdbg/expect/tealdbg_expect_test.go @@ -23,6 +23,8 @@ import ( // TestTealdbgWithExpect processes all expect script files with suffix Test.exp within the test/e2e-go/cli/tealdbg/expect directory func TestTealdbgWithExpect(t *testing.T) { + // partitiontest.PartitionTest(t) + // Causes double partition, so commented out on purpose et := fixtures.MakeExpectTest(t) et.Run() } diff --git a/test/scripts/e2e_go_tests.sh b/test/scripts/e2e_go_tests.sh index 56d1eb38e8..c829170e5e 100755 --- a/test/scripts/e2e_go_tests.sh +++ b/test/scripts/e2e_go_tests.sh @@ -7,7 +7,16 @@ set -o pipefail export GOPATH=$(go env GOPATH) export GO111MODULE=on -GOTESTCOMMAND=${GOTESTCOMMAND:="go test"} + +# Needed for now because circleci doesn't use makefile yet +if [ -z "$(which gotestsum)" ]; then + GOTESTCOMMAND=${GOTESTCOMMAND:="go test"} +else + TEST_RESULTS=${TEST_RESULTS:="$(pwd)"} + GOTESTCOMMAND=${GOTESTCOMMAND:="gotestsum --format testname --junitfile ${TEST_RESULTS}/results.xml --jsonfile ${TEST_RESULTS}/testresults.json --"} +fi + +echo "GOTESTCOMMAND will be: ${GOTESTCOMMAND}" # If one or more -t are specified, use GOTESTCOMMAND -run for each diff --git a/util/condvar/timedwait_test.go b/util/condvar/timedwait_test.go index 9faf9e8c93..bfc9daae5f 100644 --- a/util/condvar/timedwait_test.go +++ b/util/condvar/timedwait_test.go @@ -23,10 +23,12 @@ import ( "github.com/stretchr/testify/require" + "github.com/algorand/go-algorand/test/partitiontest" "github.com/algorand/go-deadlock" ) func TestTimedWaitSignal(t *testing.T) { + partitiontest.PartitionTest(t) var m deadlock.Mutex var signal bool c := sync.NewCond(&m) @@ -51,6 +53,7 @@ func TestTimedWaitSignal(t *testing.T) { } func TestTimedWaitBroadcast(t *testing.T) { + partitiontest.PartitionTest(t) var m deadlock.Mutex var signal bool c := sync.NewCond(&m) @@ -75,6 +78,7 @@ func TestTimedWaitBroadcast(t *testing.T) { } func TestTimedWaitTimeout(t *testing.T) { + partitiontest.PartitionTest(t) var m deadlock.Mutex c := sync.NewCond(&m)