Skip to content

tests: migrate callbacks_test.go to TestEnv#10330

Merged
spkane31 merged 8 commits into
mainfrom
spk/migrate-reported-problems-test
May 20, 2026
Merged

tests: migrate callbacks_test.go to TestEnv#10330
spkane31 merged 8 commits into
mainfrom
spk/migrate-reported-problems-test

Conversation

@spkane31
Copy link
Copy Markdown
Contributor

What changed?

WISOTT

Why?

Part of our migration process to testcore.TestEnv for reliability and speed purposes.

How did you test it?

  • built
  • run locally and tested manually
  • covered by existing tests
  • added new unit test(s)
  • added new functional test(s)

Potential risks

None, test file changes only

@spkane31 spkane31 requested review from a team as code owners May 19, 2026 17:55
@spkane31 spkane31 requested a review from stephanos May 19, 2026 18:07
@spkane31 spkane31 force-pushed the spk/migrate-reported-problems-test branch from 4f9daf1 to 466fd9b Compare May 19, 2026 18:26
Comment thread tests/callbacks_test.go Outdated
}

func (s *CallbacksSuite) runNexusCompletionHTTPServer(t *testing.T, h *completionHandler) string {
func runNexusCompletionHTTPServer(t *testing.T, h *completionHandler) string {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we make this a helper method on the suite? With free floating functions we always run a risk of conflicts with other files in this large package.

Copy link
Copy Markdown
Contributor

@stephanos stephanos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing blocking, just some recommendations

Comment thread tests/callbacks_test.go
Comment on lines +110 to +118
env := testcore.NewEnv(s.T(), opts...)
env.OverrideDynamicConfig(dynamicconfig.FrontendCallbackURLMaxLength, 50)
env.OverrideDynamicConfig(dynamicconfig.FrontendCallbackHeaderMaxSize, 6)
env.OverrideDynamicConfig(dynamicconfig.MaxCallbacksPerWorkflow, 2)
env.OverrideDynamicConfig(callback.MaxPerExecution, 2)
env.OverrideDynamicConfig(
callback.AllowedAddresses,
[]any{map[string]any{"Pattern": "some-ignored-address", "AllowInsecure": true}, map[string]any{"Pattern": "some-secure-address", "AllowInsecure": false}},
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of the other suites have this pattern of having a

func (s *NexusWorkflowTestSuite) newTestEnv(opts ...testcore.TestOption) *NexusTestEnv { }

which I think makes this a little nice/shorter.

Comment thread tests/callbacks_test.go Outdated
}

_, err := s.FrontendClient().StartWorkflowExecution(ctx, request)
_, err := env.FrontendClient().StartWorkflowExecution(env.Context(), request)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we now use s.Context() everywhere? I didn't mark this one as deprecated yet as it's the only way to do it outside of parallelsuite.

Comment thread tests/callbacks_test.go Outdated
Comment on lines +199 to +202
env.OverrideDynamicConfig(
callback.AllowedAddresses,
[]any{map[string]any{"Pattern": "*", "AllowInsecure": true}},
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we had newTestEnv this could maybe be the default

Comment thread tests/callbacks_test.go

s.EventuallyWithT(
func(t *assert.CollectT) {
await.Require(s.Context(), s.T(),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

woo hoo

@spkane31 spkane31 force-pushed the spk/migrate-reported-problems-test branch from 6b6932d to 805f3e1 Compare May 19, 2026 21:17
@spkane31 spkane31 enabled auto-merge (squash) May 19, 2026 21:17
@spkane31 spkane31 merged commit 021dba1 into main May 20, 2026
70 of 72 checks passed
@spkane31 spkane31 deleted the spk/migrate-reported-problems-test branch May 20, 2026 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants