diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index b2384ae9266..22c9ec73327 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -60,7 +60,6 @@ env: PR_BASE_COMMIT: ${{ github.event.pull_request.base.sha }} DOCKER_COMPOSE_FILE: ./develop/github/docker-compose.yml TEMPORAL_VERSION_CHECK_DISABLED: 1 - BUILDKITE_ANALYTICS_TOKEN: ${{ secrets.BUILDKITE_ANALYTICS_TOKEN }} jobs: set-up-single-test: @@ -82,7 +81,7 @@ jobs: steps: - id: generate_output run: | - shards=3 + shards=8 timeout=20 # update this to TEST_TIMEOUT if you update the Makefile runs_on='["ubuntu-20.04"]' if [[ "${{ inputs.run_single_functional_test }}" == "true" || "${{ inputs.run_single_unit_test }}" == "true" ]]; then @@ -230,8 +229,6 @@ jobs: strategy: fail-fast: false runs-on: ubuntu-20.04 - env: - BUILDKITE_MESSAGE: '{"job": "unit-test"}' steps: - uses: actions/checkout@v4 with: @@ -293,8 +290,6 @@ jobs: strategy: fail-fast: false runs-on: ubuntu-20.04 - env: - BUILDKITE_MESSAGE: '{"job": "integration-test"}' steps: - uses: actions/checkout@v4 with: @@ -366,50 +361,48 @@ jobs: strategy: fail-fast: false matrix: - runs-on: ${{ fromJson(needs.set-up-single-test.outputs.runs_on) }} shard_index: ${{ fromJson(needs.set-up-single-test.outputs.shard_indices) }} - name: - - cass_es - - cass_es8 - - sqlite - - mysql8 - - postgres12 - - postgres12_pgx + name: [cass_es, sqlite] include: + # These two get all tests: - name: cass_es persistence_type: nosql persistence_driver: cassandra containers: [cassandra, elasticsearch] es_version: v7 + - name: sqlite + persistence_type: sql + persistence_driver: sqlite + containers: [] + # The rest get smoke tests only: - name: cass_es8 persistence_type: nosql persistence_driver: cassandra containers: [cassandra, elasticsearch8] es_version: v8 - - name: sqlite - persistence_type: sql - persistence_driver: sqlite - containers: [] + shard_index: smoke_only - name: mysql8 persistence_type: sql persistence_driver: mysql8 containers: [mysql] + shard_index: smoke_only - name: postgres12 persistence_type: sql persistence_driver: postgres12 containers: [postgresql] + shard_index: smoke_only - name: postgres12_pgx persistence_type: sql persistence_driver: postgres12_pgx containers: [postgresql] - runs-on: ${{ matrix.runs-on }} + shard_index: smoke_only + runs-on: ${{ fromJson(needs.set-up-single-test.outputs.runs_on) }} env: TEST_TOTAL_SHARDS: ${{ needs.set-up-single-test.outputs.total_shards }} TEST_SHARD_INDEX: ${{ matrix.shard_index }} PERSISTENCE_TYPE: ${{ matrix.persistence_type }} PERSISTENCE_DRIVER: ${{ matrix.persistence_driver }} TEST_TIMEOUT: ${{ needs.set-up-single-test.outputs.test_timeout }} - BUILDKITE_MESSAGE: '{"job": "functional-test", "db": "${{ matrix.persistence_driver }}"}' steps: - uses: ScribeMD/docker-cache@0.3.7 if: ${{ inputs.run_single_functional_test != true || (inputs.run_single_functional_test == true && contains(fromJSON(needs.set-up-single-test.outputs.dbs), env.PERSISTENCE_DRIVER)) }} @@ -460,7 +453,7 @@ jobs: uses: actions/upload-artifact@v4.4.3 if: ${{ !cancelled() && !inputs.run_single_functional_test }} with: - name: junit-xml--${{github.run_id}}--${{github.run_attempt}}--${{matrix.runs-on}}--${{matrix.name}}--${{matrix.shard_index}}--functional-test + name: junit-xml--${{github.run_id}}--${{github.run_attempt}}--${{matrix.name}}--${{matrix.shard_index}}--functional-test path: .testoutput include-hidden-files: true retention-days: 28 @@ -484,39 +477,44 @@ jobs: strategy: fail-fast: false matrix: - name: [cass_es, cass_es8, mysql8, postgres12, postgres12_pgx] + name: [cass_es, sqlite] + # TODO: remote this: name: [cass_es, cass_es8, mysql8, postgres12, postgres12_pgx] include: - name: cass_es persistence_type: nosql persistence_driver: elasticsearch - parallel_flags: "" containers: [cassandra, elasticsearch] - - name: cass_es8 - persistence_type: nosql - persistence_driver: elasticsearch - parallel_flags: "" - containers: [cassandra, elasticsearch8] - - name: mysql8 - persistence_type: sql - persistence_driver: mysql8 - parallel_flags: "" - containers: [mysql] - - name: postgres12 - persistence_type: sql - persistence_driver: postgres12 - parallel_flags: "-parallel=2" # reduce parallelism for postgres - containers: [postgresql] - - name: postgres12_pgx + # parallel_flags: "" + - name: sqlite persistence_type: sql - persistence_driver: postgres12_pgx - parallel_flags: "-parallel=2" # reduce parallelism for postgres - containers: [postgresql] + persistence_driver: sqlite + containers: [] + # parallel_flags: "" + # - name: cass_es8 + # persistence_type: nosql + # persistence_driver: elasticsearch + # parallel_flags: "" + # containers: [cassandra, elasticsearch8] + # - name: mysql8 + # persistence_type: sql + # persistence_driver: mysql8 + # parallel_flags: "" + # containers: [mysql] + # - name: postgres12 + # persistence_type: sql + # persistence_driver: postgres12 + # parallel_flags: "-parallel=2" # reduce parallelism for postgres + # containers: [postgresql] + # - name: postgres12_pgx + # persistence_type: sql + # persistence_driver: postgres12_pgx + # parallel_flags: "-parallel=2" # reduce parallelism for postgres + # containers: [postgresql] runs-on: ubuntu-20.04 env: PERSISTENCE_TYPE: ${{ matrix.persistence_type }} PERSISTENCE_DRIVER: ${{ matrix.persistence_driver }} - BUILDKITE_MESSAGE: '{"job": "functional-test-xdc", "db": "${{ matrix.persistence_driver }}"}' - TEST_PARALLEL_FLAGS: ${{ matrix.parallel_flags }} + # TEST_PARALLEL_FLAGS: ${{ matrix.parallel_flags }} steps: - uses: actions/checkout@v4 with: @@ -581,35 +579,35 @@ jobs: strategy: fail-fast: false matrix: - name: - - cass_es - - cass_es8 - - mysql8 - - postgres12 - - postgres12_pgx + name: [cass_es, sqlite] + # TODO: remove this: name: [cass_es, cass_es8, mysql8, postgres12, postgres12_pgx] include: - name: cass_es persistence_type: nosql persistence_driver: elasticsearch containers: [cassandra, elasticsearch] es_version: v7 - - name: cass_es8 - persistence_type: nosql - persistence_driver: elasticsearch - containers: [cassandra, elasticsearch8] - es_version: v8 - - name: mysql8 - persistence_type: sql - persistence_driver: mysql8 - containers: [mysql] - - name: postgres12 - persistence_type: sql - persistence_driver: postgres12 - containers: [postgresql] - - name: postgres12_pgx + - name: sqlite persistence_type: sql - persistence_driver: postgres12_pgx - containers: [postgresql] + persistence_driver: sqlite + containers: [] + # - name: cass_es8 + # persistence_type: nosql + # persistence_driver: elasticsearch + # containers: [cassandra, elasticsearch8] + # es_version: v8 + # - name: mysql8 + # persistence_type: sql + # persistence_driver: mysql8 + # containers: [mysql] + # - name: postgres12 + # persistence_type: sql + # persistence_driver: postgres12 + # containers: [postgresql] + # - name: postgres12_pgx + # persistence_type: sql + # persistence_driver: postgres12_pgx + # containers: [postgresql] runs-on: ubuntu-20.04 env: PERSISTENCE_TYPE: ${{ matrix.persistence_type }} diff --git a/tests/links_test.go b/tests/links_test.go index 184dee22389..05ca49d757c 100644 --- a/tests/links_test.go +++ b/tests/links_test.go @@ -43,6 +43,7 @@ type LinksSuite struct { } func TestLinksTestSuite(t *testing.T) { + t.Parallel() suite.Run(t, new(LinksSuite)) } diff --git a/tests/namespace_delete_test.go b/tests/namespace_delete_test.go index a0952623d13..46211ab5229 100644 --- a/tests/namespace_delete_test.go +++ b/tests/namespace_delete_test.go @@ -79,6 +79,9 @@ func TestNamespaceSuite(t *testing.T) { } func (s *namespaceTestSuite) SetupSuite() { + // This suite doesn't embed FunctionalTestBase so we have to call CheckTestShard manually. + testcore.CheckTestShard(s.T()) + s.logger = log.NewTestLogger() s.testClusterFactory = testcore.NewTestClusterFactory() diff --git a/tests/testcore/client.go b/tests/testcore/client.go deleted file mode 100644 index aa670d81a80..00000000000 --- a/tests/testcore/client.go +++ /dev/null @@ -1,46 +0,0 @@ -// The MIT License -// -// Copyright (c) 2020 Temporal Technologies Inc. All rights reserved. -// -// Copyright (c) 2020 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package testcore - -import ( - "go.temporal.io/api/workflowservice/v1" - "go.temporal.io/server/api/adminservice/v1" - "go.temporal.io/server/api/historyservice/v1" -) - -// AdminClient is the interface exposed by admin service client -type AdminClient interface { - adminservice.AdminServiceClient -} - -// FrontendClient is the interface exposed by frontend service client -type FrontendClient interface { - workflowservice.WorkflowServiceClient -} - -// HistoryClient is the interface exposed by history service client -type HistoryClient interface { - historyservice.HistoryServiceClient -} diff --git a/tests/testcore/functional_test_base.go b/tests/testcore/functional_test_base.go index 6d57aa59847..6e0d6bc5a23 100644 --- a/tests/testcore/functional_test_base.go +++ b/tests/testcore/functional_test_base.go @@ -31,7 +31,10 @@ import ( "fmt" "maps" "os" + "slices" "strconv" + "strings" + "testing" "time" "github.com/dgryski/go-farm" @@ -78,12 +81,28 @@ type ( foreignNamespace string archivalNamespace string dynamicConfigOverrides map[dynamicconfig.Key]interface{} + fixedMatchingBehavior *matchingBehaviorOptions } // TestClusterParams contains the variables which are used to configure test suites via the Option type. TestClusterParams struct { ServiceOptions map[primitives.ServiceName][]fx.Option } Option func(params *TestClusterParams) + + matchingBehaviorOptions struct { + forcePollForward bool + forceTaskForward bool + forceAsync bool + } +) + +var ( + smokeTestSuites = []string{ + "TestAdvancedVisibilitySuite", + "TestClientMiscTestSuite", + } + + FixedMatchingBehaviorNone = &matchingBehaviorOptions{} ) // WithFxOptionsForService returns an Option which, when passed as an argument to setupSuite, will append the given list @@ -111,11 +130,11 @@ func (s *FunctionalTestBase) GetTestClusterConfig() *TestClusterConfig { return s.testClusterConfig } -func (s *FunctionalTestBase) FrontendClient() FrontendClient { +func (s *FunctionalTestBase) FrontendClient() workflowservice.WorkflowServiceClient { return s.client } -func (s *FunctionalTestBase) AdminClient() AdminClient { +func (s *FunctionalTestBase) AdminClient() adminservice.AdminServiceClient { return s.adminClient } @@ -147,7 +166,15 @@ func (s *FunctionalTestBase) SetDynamicConfigOverrides(dynamicConfig map[dynamic s.dynamicConfigOverrides = dynamicConfig } +// All test suites that inherit FunctionalTestBase and overwrite SetupSuite must +// call this testcore FunctionalTestBase.SetupSuite function to distribute the suites +// into partitions. Otherwise, the test suite will be executed multiple times +// in each partition. +// Furthermore, all test suites in the "tests/" directory that don't inherit +// from FunctionalTestBase must implement SetupSuite that calls checkTestShard. func (s *FunctionalTestBase) SetupSuite(defaultClusterConfigFile string, options ...Option) { + CheckTestShard(s.T()) + s.testClusterFactory = NewTestClusterFactory() params := ApplyTestClusterParams(options) @@ -196,43 +223,53 @@ func (s *FunctionalTestBase) SetupSuite(defaultClusterConfigFile string, options } } -// All test suites that inherit FunctionalTestBase and overwrite SetupTest must -// call this testcore FunctionalTestBase.SetupTest function to distribute the tests -// into partitions. Otherwise, the test suite will be executed multiple times -// in each partition. -// Furthermore, all test suites in the "tests/" directory that don't inherit -// from FunctionalTestBase must implement SetupTest that calls checkTestShard. func (s *FunctionalTestBase) SetupTest() { - s.checkTestShard() } -// checkTestShard supports test sharding based on environment variables. -func (s *FunctionalTestBase) checkTestShard() { - totalStr := os.Getenv("TEST_TOTAL_SHARDS") +// CheckTestShard supports test sharding based on environment variables. +func CheckTestShard(t *testing.T) { indexStr := os.Getenv("TEST_SHARD_INDEX") + // special value to run only a few suites on the extended set of persistence drivers + if indexStr == "smoke_only" { + suiteName, _, _ := strings.Cut(t.Name(), "/") + if slices.Contains(smokeTestSuites, suiteName) { + t.Logf("Running %s in smoke tests", t.Name()) + return + } + t.Skipf("Skipping %s, not included in smoke tests", t.Name()) + } + + totalStr := os.Getenv("TEST_TOTAL_SHARDS") if totalStr == "" || indexStr == "" { return } + total, err := strconv.Atoi(totalStr) if err != nil || total < 1 { - s.T().Fatal("Couldn't convert TEST_TOTAL_SHARDS") + t.Fatal("Couldn't convert TEST_TOTAL_SHARDS") } index, err := strconv.Atoi(indexStr) if err != nil || index < 0 || index >= total { - s.T().Fatal("Couldn't convert TEST_SHARD_INDEX") + t.Fatal("Couldn't convert TEST_SHARD_INDEX") } - // This was determined empirically to distribute our existing test names - // reasonably well. This can be adjusted from time to time. - // For parallelism 4, use 11. For 3, use 26. For 2, use 20. - const salt = "-salt-26" + // These values will split up the current versioning tests best: + // 6 shards: 15 37 60 69 79 90 + // 8 shards: 17 38 48 57 90 + const salt = "-salt-90" - nameToHash := s.T().Name() + salt + nameToHash := t.Name() + salt testIndex := int(farm.Fingerprint32([]byte(nameToHash))) % total if testIndex != index { - s.T().Skipf("Skipping %s in test shard %d/%d (it runs in %d)", s.T().Name(), index+1, total, testIndex+1) + t.Skipf("Skipping %s in test shard %d/%d (it runs in %d)", t.Name(), index, total, testIndex) } - s.T().Logf("Running %s in test shard %d/%d", s.T().Name(), index+1, total) + t.Logf("Running %s in test shard %d/%d", t.Name(), index, total) + + start := time.Now() + t.Cleanup(func() { + // log directly to stdout so it always shows up in output + fmt.Printf("### elapsed {%q, %f}\n", t.Name(), time.Since(start).Seconds()) + }) } func (s *FunctionalTestBase) registerNamespaceWithDefaults(name string) error { @@ -487,49 +524,81 @@ func (s *FunctionalTestBase) GetNamespaceID(namespace string) string { } func (s *FunctionalTestBase) RunTestWithMatchingBehavior(subtest func()) { + if s.fixedMatchingBehavior == FixedMatchingBehaviorNone { + s.T().Skipf("%s runs in a MB subtest", s.T().Name()) + } else if s.fixedMatchingBehavior != nil { + s.runOneTestWithMatchingBehavior(subtest, s.fixedMatchingBehavior) + } else { + for _, mbo := range AllMatchingBehaviorOptions() { + s.runOneTestWithMatchingBehavior(subtest, mbo) + } + } +} + +func (s *FunctionalTestBase) runOneTestWithMatchingBehavior(subtest func(), mbo *matchingBehaviorOptions) { + var name string + if mbo.forceTaskForward { + // force two levels of forwarding + name = "ForceTaskForward" + } else { + name = "NoTaskForward" + } + if mbo.forcePollForward { + name += "ForcePollForward" + } else { + name += "NoPollForward" + } + if mbo.forceAsync { + name += "ForceAsync" + } else { + name += "AllowSync" + } + + s.Run(name, func() { + if mbo.forceTaskForward { + s.OverrideDynamicConfig(dynamicconfig.MatchingNumTaskqueueWritePartitions, 13) + s.OverrideDynamicConfig(dynamicconfig.TestMatchingLBForceWritePartition, 11) + } else { + s.OverrideDynamicConfig(dynamicconfig.MatchingNumTaskqueueWritePartitions, 1) + } + if mbo.forcePollForward { + s.OverrideDynamicConfig(dynamicconfig.MatchingNumTaskqueueReadPartitions, 13) + s.OverrideDynamicConfig(dynamicconfig.TestMatchingLBForceReadPartition, 5) + } else { + s.OverrideDynamicConfig(dynamicconfig.MatchingNumTaskqueueReadPartitions, 1) + } + if mbo.forceAsync { + s.OverrideDynamicConfig(dynamicconfig.TestMatchingDisableSyncMatch, true) + } else { + s.OverrideDynamicConfig(dynamicconfig.TestMatchingDisableSyncMatch, false) + } + + subtest() + }) +} + +func (s *FunctionalTestBase) SetFixedMatchingBehavior(mbo *matchingBehaviorOptions) { + s.fixedMatchingBehavior = mbo +} + +func (s *FunctionalTestBase) SkipIfFixedMatchingBehavior() { + if s.fixedMatchingBehavior != nil && s.fixedMatchingBehavior != FixedMatchingBehaviorNone { + s.T().Skipf("%s runs in 'Others' subtest", s.T().Name()) + } +} + +func AllMatchingBehaviorOptions() []*matchingBehaviorOptions { + out := make([]*matchingBehaviorOptions, 0, 8) for _, forcePollForward := range []bool{false, true} { for _, forceTaskForward := range []bool{false, true} { for _, forceAsync := range []bool{false, true} { - name := "NoTaskForward" - if forceTaskForward { - // force two levels of forwarding - name = "ForceTaskForward" - } - if forcePollForward { - name += "ForcePollForward" - } else { - name += "NoPollForward" - } - if forceAsync { - name += "ForceAsync" - } else { - name += "AllowSync" - } - - s.Run( - name, func() { - if forceTaskForward { - s.OverrideDynamicConfig(dynamicconfig.MatchingNumTaskqueueWritePartitions, 13) - s.OverrideDynamicConfig(dynamicconfig.TestMatchingLBForceWritePartition, 11) - } else { - s.OverrideDynamicConfig(dynamicconfig.MatchingNumTaskqueueWritePartitions, 1) - } - if forcePollForward { - s.OverrideDynamicConfig(dynamicconfig.MatchingNumTaskqueueReadPartitions, 13) - s.OverrideDynamicConfig(dynamicconfig.TestMatchingLBForceReadPartition, 5) - } else { - s.OverrideDynamicConfig(dynamicconfig.MatchingNumTaskqueueReadPartitions, 1) - } - if forceAsync { - s.OverrideDynamicConfig(dynamicconfig.TestMatchingDisableSyncMatch, true) - } else { - s.OverrideDynamicConfig(dynamicconfig.TestMatchingDisableSyncMatch, false) - } - - subtest() - }, - ) + out = append(out, &matchingBehaviorOptions{ + forcePollForward: forcePollForward, + forceTaskForward: forceTaskForward, + forceAsync: forceAsync, + }) } } } + return out } diff --git a/tests/testcore/test_cluster.go b/tests/testcore/test_cluster.go index 01f7f24b4b0..94a799c91cb 100644 --- a/tests/testcore/test_cluster.go +++ b/tests/testcore/test_cluster.go @@ -37,6 +37,7 @@ import ( "github.com/pborman/uuid" "go.temporal.io/api/operatorservice/v1" + "go.temporal.io/api/workflowservice/v1" "go.temporal.io/server/api/adminservice/v1" "go.temporal.io/server/api/historyservice/v1" "go.temporal.io/server/api/matchingservice/v1" @@ -540,12 +541,12 @@ func (tc *TestCluster) ArchivalBase() *ArchiverBase { } // FrontendClient returns a frontend client from the test cluster -func (tc *TestCluster) FrontendClient() FrontendClient { +func (tc *TestCluster) FrontendClient() workflowservice.WorkflowServiceClient { return tc.host.FrontendClient() } // AdminClient returns an admin client from the test cluster -func (tc *TestCluster) AdminClient() AdminClient { +func (tc *TestCluster) AdminClient() adminservice.AdminServiceClient { return tc.host.AdminClient() } diff --git a/tests/update_workflow_sdk_test.go b/tests/update_workflow_sdk_test.go index 470af01eac0..320fa2fe3a4 100644 --- a/tests/update_workflow_sdk_test.go +++ b/tests/update_workflow_sdk_test.go @@ -52,8 +52,7 @@ type UpdateWorkflowSdkSuite struct { func TestUpdateWorkflowSdkSuite(t *testing.T) { t.Parallel() - s := new(UpdateWorkflowSdkSuite) - suite.Run(t, s) + suite.Run(t, new(UpdateWorkflowSdkSuite)) } func (s *UpdateWorkflowSdkSuite) TestUpdateWorkflow_TerminateWorkflowAfterUpdateAdmitted() { diff --git a/tests/update_workflow_test.go b/tests/update_workflow_test.go index fd0c646f811..b02b1adce47 100644 --- a/tests/update_workflow_test.go +++ b/tests/update_workflow_test.go @@ -61,8 +61,7 @@ type UpdateWorkflowSuite struct { func TestUpdateWorkflowSuite(t *testing.T) { t.Parallel() - s := new(UpdateWorkflowSuite) - suite.Run(t, s) + suite.Run(t, new(UpdateWorkflowSuite)) } // TODO: extract sendUpdate* methods to separate package. diff --git a/tests/versioning_test.go b/tests/versioning_test.go index d2308aec936..10a6db8ae28 100644 --- a/tests/versioning_test.go +++ b/tests/versioning_test.go @@ -80,9 +80,23 @@ const ( testReachabilityCacheClosedWFsTTL = 6 * time.Millisecond ) -func TestVersioningFunctionalSuite(t *testing.T) { - t.Parallel() - suite.Run(t, new(VersioningIntegSuite)) +func TestVersioningSuite(t *testing.T) { + for i, mbo := range testcore.AllMatchingBehaviorOptions() { + t.Run(fmt.Sprintf("MB%d", i), func(t *testing.T) { + // These sub-tests run tests that use RunTestWithMatchingBehavior, with one behavior per sub-test. + t.Parallel() + s := new(VersioningIntegSuite) + s.SetFixedMatchingBehavior(mbo) + suite.Run(t, s) + }) + } + t.Run("Others", func(t *testing.T) { + // This sub-test runs all tests that do _not_ use RunTestWithMatchingBehavior. + t.Parallel() + s := new(VersioningIntegSuite) + s.SetFixedMatchingBehavior(testcore.FixedMatchingBehaviorNone) + suite.Run(t, new(VersioningIntegSuite)) + }) } func (s *VersioningIntegSuite) SetupSuite() { @@ -154,6 +168,8 @@ func (s *VersioningIntegSuite) TearDownTest() { } func (s *VersioningIntegSuite) TestVersionRuleConflictToken() { + s.SkipIfFixedMatchingBehavior() + ctx := testcore.NewContext() tq := "test-conflict-token" @@ -194,6 +210,8 @@ func (s *VersioningIntegSuite) TestVersionRuleConflictToken() { } func (s *VersioningIntegSuite) TestVersionRuleBuildIdValidation() { + s.SkipIfFixedMatchingBehavior() + // setup ctx := testcore.NewContext() tq := "test-build-id-validation" @@ -216,6 +234,8 @@ func (s *VersioningIntegSuite) TestVersionRuleBuildIdValidation() { } func (s *VersioningIntegSuite) TestAssignmentRuleInsert() { + s.SkipIfFixedMatchingBehavior() + // setup ctx := testcore.NewContext() tq := "test-assignment-rule-insert" @@ -238,6 +258,8 @@ func (s *VersioningIntegSuite) TestAssignmentRuleInsert() { } func (s *VersioningIntegSuite) TestAssignmentRuleReplace() { + s.SkipIfFixedMatchingBehavior() + // setup ctx := testcore.NewContext() tq := "test-assignment-rule-replace" @@ -262,6 +284,8 @@ func (s *VersioningIntegSuite) TestAssignmentRuleReplace() { } func (s *VersioningIntegSuite) TestAssignmentRuleDelete() { + s.SkipIfFixedMatchingBehavior() + // setup ctx := testcore.NewContext() tq := "test-assignment-rule-delete" @@ -290,6 +314,8 @@ func (s *VersioningIntegSuite) TestAssignmentRuleDelete() { } func (s *VersioningIntegSuite) TestRedirectRuleInsert() { + s.SkipIfFixedMatchingBehavior() + // setup ctx := testcore.NewContext() tq := "test-redirect-rule-insert" @@ -313,6 +339,8 @@ func (s *VersioningIntegSuite) TestRedirectRuleInsert() { } func (s *VersioningIntegSuite) TestRedirectRuleReplace() { + s.SkipIfFixedMatchingBehavior() + // setup ctx := testcore.NewContext() tq := "test-redirect-rule-replace" @@ -337,6 +365,8 @@ func (s *VersioningIntegSuite) TestRedirectRuleReplace() { } func (s *VersioningIntegSuite) TestRedirectRuleDelete() { + s.SkipIfFixedMatchingBehavior() + // setup ctx := testcore.NewContext() tq := "test-redirect-rule-delete" @@ -360,6 +390,8 @@ func (s *VersioningIntegSuite) TestRedirectRuleDelete() { } func (s *VersioningIntegSuite) TestCommitBuildID() { + s.SkipIfFixedMatchingBehavior() + // setup ctx := testcore.NewContext() tq := "test-commit-build-id" @@ -406,6 +438,8 @@ func mkRedirectRulesMap(redirectRules []*taskqueuepb.TimestampedCompatibleBuildI } func (s *VersioningIntegSuite) TestBasicVersionUpdate() { + s.SkipIfFixedMatchingBehavior() + ctx := testcore.NewContext() tq := "functional-versioning-basic" @@ -422,6 +456,8 @@ func (s *VersioningIntegSuite) TestBasicVersionUpdate() { } func (s *VersioningIntegSuite) TestSeriesOfUpdates() { + s.SkipIfFixedMatchingBehavior() + ctx := testcore.NewContext() tq := "functional-versioning-series" @@ -442,6 +478,8 @@ func (s *VersioningIntegSuite) TestSeriesOfUpdates() { } func (s *VersioningIntegSuite) TestLinkToNonexistentCompatibleVersionReturnsNotFound() { + s.SkipIfFixedMatchingBehavior() + ctx := testcore.NewContext() tq := "functional-versioning-compat-not-found" @@ -461,6 +499,8 @@ func (s *VersioningIntegSuite) TestLinkToNonexistentCompatibleVersionReturnsNotF } func (s *VersioningIntegSuite) TestVersioningStatePersistsAcrossUnload() { + s.SkipIfFixedMatchingBehavior() + ctx := testcore.NewContext() tq := "functional-versioning-persists" @@ -479,6 +519,8 @@ func (s *VersioningIntegSuite) TestVersioningStatePersistsAcrossUnload() { } func (s *VersioningIntegSuite) TestVersioningChangesPropagate() { + s.SkipIfFixedMatchingBehavior() + ctx := testcore.NewContext() tq := "functional-versioning-propagate" @@ -495,6 +537,8 @@ func (s *VersioningIntegSuite) TestVersioningChangesPropagate() { } func (s *VersioningIntegSuite) TestMaxTaskQueuesPerBuildIdEnforced() { + s.SkipIfFixedMatchingBehavior() + ctx := testcore.NewContext() buildId := fmt.Sprintf("b-%s", s.T().Name()) // Map a 3 task queues to this build ID and verify success @@ -524,42 +568,6 @@ func (s *VersioningIntegSuite) TestMaxTaskQueuesPerBuildIdEnforced() { s.Equal("Exceeded max task queues allowed to be mapped to a single build ID: 3", failedPreconditionError.Message) } -//func (s *VersioningIntegSuite) testWithMatchingBehavior(subtest func()) { -// for _, forceForward := range []bool{false, true} { -// for _, forceAsync := range []bool{false, true} { -// name := "NoForward" -// if forceForward { -// // force two levels of forwarding -// name = "ForceForward" -// } -// if forceAsync { -// name += "ForceAsync" -// } else { -// name += "AllowSync" -// } -// -// s.Run(name, func() { -// if forceForward { -// s.OverrideDynamicConfig(dynamicconfig.MatchingNumTaskqueueReadPartitions, 13) -// s.OverrideDynamicConfig(dynamicconfig.MatchingNumTaskqueueWritePartitions, 13) -// s.OverrideDynamicConfig(dynamicconfig.TestMatchingLBForceReadPartition, 5) -// s.OverrideDynamicConfig(dynamicconfig.TestMatchingLBForceWritePartition, 11) -// } else { -// s.OverrideDynamicConfig(dynamicconfig.MatchingNumTaskqueueReadPartitions, 1) -// s.OverrideDynamicConfig(dynamicconfig.MatchingNumTaskqueueWritePartitions, 1) -// } -// if forceAsync { -// s.OverrideDynamicConfig(dynamicconfig.TestMatchingDisableSyncMatch, true) -// } else { -// s.OverrideDynamicConfig(dynamicconfig.TestMatchingDisableSyncMatch, false) -// } -// -// subtest() -// }) -// } -// } -//} - func (s *VersioningIntegSuite) TestDispatchNewWorkflowOld() { s.RunTestWithMatchingBehavior(func() { s.dispatchNewWorkflow(false) }) } @@ -611,6 +619,8 @@ func (s *VersioningIntegSuite) dispatchNewWorkflow(newVersioning bool) { } func (s *VersioningIntegSuite) TestDispatchNewWorkflowWithRamp() { + s.SkipIfFixedMatchingBehavior() + tq := testcore.RandomizeStr(s.T().Name()) v1 := s.prefixed("v1") v2 := s.prefixed("v2") @@ -2017,6 +2027,8 @@ func (s *VersioningIntegSuite) dispatchActivity(failMode activityFailMode, newVe } func (s *VersioningIntegSuite) TestDispatchActivityUpgrade() { + s.SkipIfFixedMatchingBehavior() + // Testing: // - redirecting dependent activity redirects wf // - this also implicitly verifies that sticky queue is cleared after redirecting activity task @@ -2162,6 +2174,8 @@ func (s *VersioningIntegSuite) TestDispatchActivityUpgrade() { } func (s *VersioningIntegSuite) TestRedirectWithConcurrentActivities() { + s.SkipIfFixedMatchingBehavior() + // Testing that wf never "goes back" to older build ID in presence of concurrent activities and random failures. // // SETUP: @@ -2465,6 +2479,8 @@ func (s *VersioningIntegSuite) dispatchActivityCompatible() { } func (s *VersioningIntegSuite) TestDispatchActivityEager() { + s.SkipIfFixedMatchingBehavior() + s.OverrideDynamicConfig(dynamicconfig.EnableActivityEagerExecution, true) tq := testcore.RandomizeStr(s.T().Name()) @@ -2537,6 +2553,8 @@ func (s *VersioningIntegSuite) TestDispatchActivityEager() { } func (s *VersioningIntegSuite) TestDispatchActivityCrossTQFails() { + s.SkipIfFixedMatchingBehavior() + s.OverrideDynamicConfig(dynamicconfig.MatchingNumTaskqueueReadPartitions, 1) s.OverrideDynamicConfig(dynamicconfig.MatchingNumTaskqueueWritePartitions, 1) @@ -2881,6 +2899,8 @@ func (s *VersioningIntegSuite) dispatchChildWorkflowUpgrade(newVersioning bool) } func (s *VersioningIntegSuite) TestDispatchChildWorkflowCrossTQFails() { + s.SkipIfFixedMatchingBehavior() + s.OverrideDynamicConfig(dynamicconfig.MatchingNumTaskqueueReadPartitions, 1) s.OverrideDynamicConfig(dynamicconfig.MatchingNumTaskqueueWritePartitions, 1) @@ -3701,6 +3721,8 @@ func (s *VersioningIntegSuite) dispatchCron(newVersioning bool) { } func (s *VersioningIntegSuite) TestResetWorkflowAssignsToCorrectBuildId() { + s.SkipIfFixedMatchingBehavior() + tq := testcore.RandomizeStr(s.T().Name()) v1 := s.prefixed("v1") v2 := s.prefixed("v2") @@ -3760,10 +3782,14 @@ func (s *VersioningIntegSuite) TestResetWorkflowAssignsToCorrectBuildId() { } func (s *VersioningIntegSuite) TestResetWorkflowAssignsToCorrectBuildId_CaN_Inherit() { + s.SkipIfFixedMatchingBehavior() + s.resetWorkflowAssignsToCorrectBuildIdCan(true) } func (s *VersioningIntegSuite) TestResetWorkflowAssignsToCorrectBuildId_CaN_NoInherit() { + s.SkipIfFixedMatchingBehavior() + s.resetWorkflowAssignsToCorrectBuildIdCan(false) } @@ -3848,10 +3874,14 @@ func (s *VersioningIntegSuite) resetWorkflowAssignsToCorrectBuildIdCan(inheritBu } func (s *VersioningIntegSuite) TestResetWorkflowAssignsToCorrectBuildId_ChildWF_Inherit() { + s.SkipIfFixedMatchingBehavior() + s.resetWorkflowAssignsToCorrectBuildIdChildWf(true) } func (s *VersioningIntegSuite) TestResetWorkflowAssignsToCorrectBuildId_ChildWF_NoInherit() { + s.SkipIfFixedMatchingBehavior() + s.resetWorkflowAssignsToCorrectBuildIdChildWf(false) } @@ -4013,6 +4043,8 @@ func (s *VersioningIntegSuite) validateBuildIdAfterReset(ctx context.Context, wf } func (s *VersioningIntegSuite) TestDescribeTaskQueueEnhanced_Versioned_ReachabilityCache() { + s.SkipIfFixedMatchingBehavior() + tq := testcore.RandomizeStr(s.T().Name()) ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) defer cancel() @@ -4072,6 +4104,8 @@ func (s *VersioningIntegSuite) TestDescribeTaskQueueEnhanced_Versioned_Reachabil } func (s *VersioningIntegSuite) TestDescribeTaskQueueEnhanced_Versioned_BasicReachability() { + s.SkipIfFixedMatchingBehavior() + tq := testcore.RandomizeStr(s.T().Name()) ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) defer cancel() @@ -4143,6 +4177,8 @@ func (s *VersioningIntegSuite) TestDescribeTaskQueueEnhanced_Versioned_BasicReac } func (s *VersioningIntegSuite) TestDescribeTaskQueueEnhanced_Unversioned() { + s.SkipIfFixedMatchingBehavior() + tq := testcore.RandomizeStr(s.T().Name()) wf := func(ctx workflow.Context) (string, error) { return "ok", nil } ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) @@ -4198,6 +4234,8 @@ func (s *VersioningIntegSuite) TestDescribeTaskQueueEnhanced_Unversioned() { } func (s *VersioningIntegSuite) TestDescribeTaskQueueEnhanced_ReportFlags() { + s.SkipIfFixedMatchingBehavior() + tq := testcore.RandomizeStr(s.T().Name()) wf := func(ctx workflow.Context) (string, error) { return "ok", nil } ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) @@ -4280,6 +4318,8 @@ func (s *VersioningIntegSuite) TestDescribeTaskQueueEnhanced_ReportFlags() { } func (s *VersioningIntegSuite) TestDescribeTaskQueueEnhanced_TooManyBuildIds() { + s.SkipIfFixedMatchingBehavior() + tq := testcore.RandomizeStr(s.T().Name()) ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) defer cancel() @@ -4312,6 +4352,8 @@ func (s *VersioningIntegSuite) TestDescribeTaskQueueEnhanced_TooManyBuildIds() { } func (s *VersioningIntegSuite) TestDescribeTaskQueueLegacy_VersionSets() { + s.SkipIfFixedMatchingBehavior() + // force one partition since DescribeTaskQueue only goes to the root s.OverrideDynamicConfig(dynamicconfig.MatchingNumTaskqueueReadPartitions, 1) s.OverrideDynamicConfig(dynamicconfig.MatchingNumTaskqueueWritePartitions, 1) @@ -4379,6 +4421,8 @@ func (s *VersioningIntegSuite) TestDescribeTaskQueueLegacy_VersionSets() { } func (s *VersioningIntegSuite) TestDescribeWorkflowExecution() { + s.SkipIfFixedMatchingBehavior() + s.OverrideDynamicConfig(dynamicconfig.MatchingNumTaskqueueReadPartitions, 4) s.OverrideDynamicConfig(dynamicconfig.MatchingNumTaskqueueWritePartitions, 4)