Skip to content

Conversation

@Aggarwalmansi
Copy link

What

Refactors test helpers to use t.Cleanup instead of defer for resource cleanup.

Why

t.Cleanup ties cleanup logic to the test lifecycle, ensuring correctness with
subtests and parallel execution, as recommended by Go testing best practices.

Changes

  • Replaced defer ctrl.Finish() with t.Cleanup(ctrl.Finish)
  • Updated temp file helper functions to use t.Cleanup
  • No behavior change; test coverage remains intact

Verification

  • go test ./pkg/gofr/...

Fixes #855

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.

Consider using t.Cleanup in testing helpers

1 participant