Skip to content

Migrate tests/activity_test.go to testEnv#9678

Closed
chaptersix wants to merge 4 commits intotemporalio:mainfrom
chaptersix:activity-test-env
Closed

Migrate tests/activity_test.go to testEnv#9678
chaptersix wants to merge 4 commits intotemporalio:mainfrom
chaptersix:activity-test-env

Conversation

@chaptersix
Copy link
Contributor

Summary

  • Convert ActivityTestSuite and ActivityClientTestSuite from suite-based testing (FunctionalTestBase + testify suite.Run) to function-based testcore.NewEnv() pattern
  • Convert mockWorkflowWithErrorActivity helper from receiver method to package-level function
  • Fix pre-existing lint issues exposed by the migration (switch default cases, goroutine require assertions, context-aware channel operations)

Test plan

  • make lint passes clean
  • go test -run TestActivityTestSuite ./tests/... -- 9/9 pass
  • go test -run TestActivityClientTestSuite ./tests/... -- 5/5 pass

Convert ActivityTestSuite and ActivityClientTestSuite from suite-based
testing (FunctionalTestBase + testify suite.Run) to function-based
testcore.NewEnv() pattern. Convert helper method
mockWorkflowWithErrorActivity to package-level function.
Add default cases to switch statements to satisfy enforce-switch-style.
Restructure goroutines to move require assertions back to the test
goroutine, satisfying the go-require lint rule. Add context-based
cancellation to channel operations in activity handlers so goroutines
don't hang if the test fails early.
Add default cases to switch statements to satisfy enforce-switch-style.
Restructure goroutines to move require assertions back to the test
goroutine, satisfying the go-require lint rule. Add context-based
cancellation to channel operations in activity handlers and test
goroutines so they don't hang if the test fails early.
@chaptersix
Copy link
Contributor Author

hard to track the changes via diff. will need to take a closer look later.

Move each test body from inline t.Run closures to standalone
package-level functions taking *testcore.TestEnv. This avoids the
extra indentation level that was inflating the diff vs main.
Mark TestActivityTestSuite as MustRunSequential since it contains
timing-sensitive cancellation and heartbeat tests.
@chaptersix chaptersix closed this Mar 26, 2026
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.

1 participant