Skip to content

Commit 11ae0d3

Browse files
committed
migrate Versioning3Suite
1 parent 76d568a commit 11ae0d3

7 files changed

Lines changed: 1420 additions & 1519 deletions

tests/activity_api_pause_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func (s *ActivityAPIPauseClientTestSuite) TestActivityPauseApi_WhileRunning() {
6262
activityFunction := func() (string, error) {
6363
startedActivityCount.Add(1)
6464
if startedActivityCount.Load() == 1 {
65-
env.WaitForChannel(ctx, activityPausedCn)
65+
env.WaitForChannel(activityPausedCn)
6666
return "", activityErr
6767
}
6868
return "done!", nil
@@ -115,7 +115,7 @@ func (s *ActivityAPIPauseClientTestSuite) TestActivityPauseApi_WhileRunning() {
115115
}, 5*time.Second, 500*time.Millisecond)
116116

117117
// unblock the activity
118-
env.SendToChannel(ctx, activityPausedCn)
118+
env.SendToChannel(activityPausedCn)
119119
// make sure activity is paused on server and completed on the worker
120120
s.EventuallyWithT(func(t *assert.CollectT) {
121121
description, err := env.SdkClient().DescribeWorkflowExecution(ctx, workflowRun.GetID(), workflowRun.GetRunID())
@@ -208,7 +208,7 @@ func (s *ActivityAPIPauseClientTestSuite) TestActivityPauseApi_IncreaseAttemptsO
208208
activityFunction := func() (string, error) {
209209
startedActivityCount.Add(1)
210210
if startedActivityCount.Load() == 1 {
211-
env.WaitForChannel(ctx, activityPausedCn)
211+
env.WaitForChannel(activityPausedCn)
212212
return "", activityErr
213213
}
214214
if shouldSucceed.Load() {
@@ -264,7 +264,7 @@ func (s *ActivityAPIPauseClientTestSuite) TestActivityPauseApi_IncreaseAttemptsO
264264
}, 5*time.Second, 500*time.Millisecond)
265265

266266
// End the activity
267-
env.SendToChannel(ctx, activityPausedCn)
267+
env.SendToChannel(activityPausedCn)
268268

269269
s.EventuallyWithT(func(t *assert.CollectT) {
270270
description, err := env.SdkClient().DescribeWorkflowExecution(ctx, workflowRun.GetID(), workflowRun.GetRunID())
@@ -559,7 +559,7 @@ func (s *ActivityAPIPauseClientTestSuite) TestActivityPauseApi_WithReset() {
559559
activityErr := errors.New("bad-luck-please-retry")
560560
return "", activityErr
561561
}
562-
env.WaitForChannel(ctx, activityCompleteCn)
562+
env.WaitForChannel(activityCompleteCn)
563563
return "done!", nil
564564
}
565565

@@ -632,7 +632,7 @@ func (s *ActivityAPIPauseClientTestSuite) TestActivityPauseApi_WithReset() {
632632
}, 5*time.Second, 100*time.Millisecond)
633633

634634
// let activity finish
635-
env.SendToChannel(ctx, activityCompleteCn)
635+
env.SendToChannel(activityCompleteCn)
636636

637637
// wait for workflow to finish
638638
var out string

tests/activity_api_reset_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func (s *ActivityApiResetClientTestSuite) TestActivityResetApi_AfterRetry() {
8787
return "", activityErr
8888
}
8989

90-
env.WaitForChannel(ctx, activityCompleteCh)
90+
env.WaitForChannel(activityCompleteCh)
9191
return "done!", nil
9292
}
9393

@@ -160,7 +160,7 @@ func (s *ActivityApiResetClientTestSuite) TestActivityResetApi_WhileRunning() {
160160
var startedActivityCount atomic.Int32
161161
activityFunction := func() (string, error) {
162162
startedActivityCount.Add(1)
163-
env.WaitForChannel(ctx, activityCompleteCh)
163+
env.WaitForChannel(activityCompleteCh)
164164
return "done!", nil
165165
}
166166

@@ -242,7 +242,7 @@ func (s *ActivityApiResetClientTestSuite) TestActivityResetApi_InRetry() {
242242
return "", activityErr
243243
}
244244

245-
env.WaitForChannel(ctx, activityCompleteCh)
245+
env.WaitForChannel(activityCompleteCh)
246246
return "done!", nil
247247
}
248248

@@ -322,7 +322,7 @@ func (s *ActivityApiResetClientTestSuite) TestActivityResetApi_KeepPaused() {
322322
return "", activityErr
323323
}
324324

325-
env.WaitForChannel(ctx, activityCompleteCh)
325+
env.WaitForChannel(activityCompleteCh)
326326
return "done!", nil
327327
}
328328

@@ -462,7 +462,7 @@ func (s *ActivityApiResetClientTestSuite) TestActivityReset_HeartbeatDetails() {
462462
return "", errors.New("bad-luck-please-retry")
463463
}
464464
// not the first iteration
465-
env.WaitForChannel(ctx, activityCompleteCh)
465+
env.WaitForChannel(activityCompleteCh)
466466
for activityShouldFinish.Load() == false {
467467
activity.RecordHeartbeat(ctx, "second")
468468
time.Sleep(time.Second) //nolint:forbidigo

tests/activity_api_update_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func (s *ActivityAPIUpdateClientTestSuite) TestActivityUpdateApi_ChangeRetryInte
8282
return "", activityErr
8383
}
8484

85-
env.WaitForChannel(ctx, activityUpdated)
85+
env.WaitForChannel(activityUpdated)
8686
return "done!", nil
8787
}
8888

@@ -327,7 +327,7 @@ func (s *ActivityAPIUpdateClientTestSuite) TestActivityUpdateApi_ResetDefaultOpt
327327
return "", activityErr
328328
}
329329

330-
env.WaitForChannel(ctx, activityUpdated)
330+
env.WaitForChannel(activityUpdated)
331331
return "done!", nil
332332
}
333333

tests/nexus_workflow_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1820,8 +1820,8 @@ func (s *NexusWorkflowTestSuite) TestNexusOperationCancelBeforeStarted_Cancelati
18201820
})
18211821
s.NoError(err)
18221822

1823-
env.SendToChannel(env.Context(), canStartCh)
1824-
env.WaitForChannel(env.Context(), cancelSentCh)
1823+
env.SendToChannel(canStartCh)
1824+
env.WaitForChannel(cancelSentCh)
18251825

18261826
// Terminate the workflow for good measure.
18271827
err = env.SdkClient().TerminateWorkflow(env.Context(), run.GetID(), run.GetRunID(), "test")

tests/testcore/dynamic_config_overrides.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ var (
2727
// unique namespaces with overrides per namespace should be used for tests that require overrides.
2828
defaultDynamicConfigOverrides = map[dynamicconfig.Key]any{
2929
dynamicconfig.FrontendRPS.Key(): 3000,
30+
dynamicconfig.FrontendNamespaceReplicationInducingAPIsRPS.Key(): 1000,
3031
dynamicconfig.FrontendMaxNamespaceVisibilityRPSPerInstance.Key(): 50,
3132
dynamicconfig.FrontendMaxNamespaceVisibilityBurstRatioPerInstance.Key(): 1,
3233
dynamicconfig.ReplicationTaskProcessorErrorRetryMaxAttempts.Key(): 1,

tests/testcore/test_env.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,24 @@ func (e *TestEnv) Context() context.Context {
310310
return e.ctx
311311
}
312312

313+
func (e *TestEnv) WaitForChannel(ch <-chan struct{}) {
314+
e.t.Helper()
315+
select {
316+
case <-ch:
317+
case <-e.ctx.Done():
318+
e.FailNow("context timeout while waiting for channel")
319+
}
320+
}
321+
322+
func (e *TestEnv) SendToChannel(ch chan<- struct{}) {
323+
e.t.Helper()
324+
select {
325+
case ch <- struct{}{}:
326+
case <-e.ctx.Done():
327+
e.FailNow("context timeout while sending to channel")
328+
}
329+
}
330+
313331
// SdkClient returns the SDK client. It is lazily initialized on the first call.
314332
func (e *TestEnv) SdkClient() sdkclient.Client {
315333
e.sdkClientOnce.Do(func() {

0 commit comments

Comments
 (0)