Skip to content

Migrate sizelimit tests to use TestEnv#9720

Draft
chaptersix wants to merge 6 commits intotemporalio:mainfrom
chaptersix:sizelimit-test-env
Draft

Migrate sizelimit tests to use TestEnv#9720
chaptersix wants to merge 6 commits intotemporalio:mainfrom
chaptersix:sizelimit-test-env

Conversation

@chaptersix
Copy link
Copy Markdown
Contributor

What changed?

  • Migrated tests/sizelimit_test.go from testify/suite + FunctionalTestBase setup to testcore.TestEnv
  • Replaced suite methods with standalone package-level test functions that take *testcore.TestEnv
  • Updated the top-level test to dispatch subtests via t.Run and removed suite wiring/import
  • Added a sizeLimitTestOpts helper with the same dynamic config overrides used by the old suite setup

Why?

Part of the ongoing piece-by-piece migration of functional tests to TestEnv, while keeping this change minimal for easier review.

How did you test it?

  • make lint
  • go test -tags disable_grpc_modules,test_dep -timeout 5m -run TestSizeLimitFunctionalSuite ./tests/...

Potential risks

Tests only.

@chaptersix chaptersix marked this pull request as ready for review March 27, 2026 13:13
@chaptersix chaptersix requested review from a team as code owners March 27, 2026 13:13
@chaptersix
Copy link
Copy Markdown
Contributor Author

Use hide white space filter in diff view.

s.FunctionalTestBase.SetupSuiteWithCluster(testcore.WithDynamicConfigOverrides(dynamicConfigOverrides))
}
// TODO use parallel suite
t.Run("TerminateWorkflowCausedByHistoryCountLimit", func(t *testing.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.

Is there an advantage of inlining all the tests vs. keeping them top-level functions, and doing something like this?

func TestSizeLimitFunctionalSuite(t *testing.T) {
	...
	t.Run(
		"TerminateWorkflowCausedByHistoryCountLimit",
		TestTerminateWorkflowCausedByHistoryCountLimit,
	)
	...

That way the old test implementations don't need to be indented and can be mostly intact from git's POV.

Asking because a lot of these indentation-only changes due to inlining can make git blame a bit more confusing to dig through

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I each sub test is shared with the whole package. We want to use suites but testify had some drawbacks. I'm about to move this over to parallel suite. (just merged)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

git blame is already not all that reliable in terms of figuring out who to ask about the test. people move around quite a bit.

- Add space in // TODO comment (revive)
- Migrate from deprecated testcore.TaskPoller to taskpoller.TaskPoller
- Replace s.IsType with s.ErrorAs (testifylint)
- Add context cancellation to single-case select statements
- Remove unreachable activitiesScheduled branch in MsSizeLimit test
Convert from t.Run subtests to parallelsuite.Suite methods for parallel
test execution. Use direct gRPC calls for activity polling in
HistoryCountLimit test due to taskpoller.PollAndHandleActivityTask bug.
@chaptersix chaptersix marked this pull request as draft March 30, 2026 22:05
Comment on lines +135 to +150
// NOTE: Using direct gRPC calls for activity polling because taskpoller.PollAndHandleActivityTask
// has a bug where it doesn't find activity tasks that are immediately available after workflow task completion.
actResp, actErr := env.FrontendClient().PollActivityTaskQueue(testcore.NewContext(), &workflowservice.PollActivityTaskQueueRequest{
Namespace: env.Namespace().String(),
TaskQueue: taskQueue,
Identity: identity,
})
s.NoError(actErr)
s.NotEmpty(actResp.GetTaskToken())
_, actErr = env.FrontendClient().RespondActivityTaskCompleted(testcore.NewContext(), &workflowservice.RespondActivityTaskCompletedRequest{
Namespace: env.Namespace().String(),
TaskToken: actResp.TaskToken,
Identity: identity,
Result: payloads.EncodeString("Activity Result"),
})
s.NoError(actErr)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

claude is struggle busing with this one. I don't like the idea of swapping over to GRPC. seems like it's hiding something.

Keep each sizelimit test focused on its own limit and document that longer poller identities can trip mutable-state/history-size limits before history-count limits.
WorkflowRunTimeout: durationpb.New(100 * time.Second),
WorkflowTaskTimeout: durationpb.New(1 * time.Second),
Identity: identity,
Identity: testcore.RandomizeStr("worker"),
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.

nit: I think this can just be hard-coded to whatever you like since the test runs in an isolation ns and isolated worker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants