Skip to content

Commit 3605d42

Browse files
maniclaude
authored andcommitted
Add WCI worker deployment routing and manager integration tests
Cover SetWorkerDeploymentCurrentVersion, SetWorkerDeploymentRampingVersion, and SetWorkerDeploymentManager against the in-process WCI test environment: - SetCurrentVersion: happy path, set-to-unversioned (with drainage to DRAINED), the missing-task-queue guardrail plus its ignore_missing_task_queues override exercised on a single backlogged state, and stale-conflict-token rejection. - SetRampingVersion: happy path, clear ramp (DRAINING -> DRAINED), ramping-equals-current rejection, and invalid-percentage rejection. - SetManager: set and override the manager identity, stale-conflict-token rejection, and enforcement that a routing mutation from a non-manager identity is rejected. Add setup helpers (setupPolledVersion, createUnpolledVersion, setupCurrentPlusSecondVersion) and configure fast version drainage in the test env so DRAINING -> DRAINED transitions are observable within the test window. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 3ee06d0 commit 3605d42

2 files changed

Lines changed: 912 additions & 0 deletions

File tree

tests/integration/env.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,21 @@ package integration
33

44
import (
55
"testing"
6+
"time"
67

78
"go.temporal.io/auto-scaled-workers/wci/client"
9+
"go.temporal.io/server/common/dynamicconfig"
810
"go.temporal.io/server/tests/testcore"
911
)
1012

13+
// Drain worker deployment versions quickly so tests that clear a current/ramping
14+
// version can observe the DRAINING -> DRAINED transition without waiting on the
15+
// multi-minute production defaults.
16+
const (
17+
testVersionDrainageRefreshInterval = 3 * time.Second
18+
testVersionDrainageVisibilityGracePeriod = 3 * time.Second
19+
)
20+
1121
// createWCITestEnv starts an in-process Temporal server with the WCI worker component registered
1222
// and returns a TestEnv ready for use. Cleanup is registered via t.Cleanup.
1323
func createWCITestEnv(t *testing.T) *testcore.TestEnv {
@@ -17,5 +27,7 @@ func createWCITestEnv(t *testing.T) *testcore.TestEnv {
1727
testcore.WithDedicatedCluster(),
1828
testcore.WithWorkerService("WCI"),
1929
testcore.WithDynamicConfig(client.WorkerControllerEnabled, true),
30+
testcore.WithDynamicConfig(dynamicconfig.VersionDrainageStatusRefreshInterval, testVersionDrainageRefreshInterval),
31+
testcore.WithDynamicConfig(dynamicconfig.VersionDrainageStatusVisibilityGracePeriod, testVersionDrainageVisibilityGracePeriod),
2032
)
2133
}

0 commit comments

Comments
 (0)