Conversation
Use the modern t.Chdir() helper instead of manual os.Chdir/defer patterns for cleaner test code with automatic cleanup. Assisted-By: cagent
Use the modern t.Setenv() helper instead of manual os.Setenv/defer os.Unsetenv patterns for cleaner test code with automatic cleanup. Updated files: - cmd/docker-mcp/catalog/reset_test.go - cmd/docker-mcp/commands/bootstrap_test.go - cmd/docker-mcp/commands/catalog_validation_test.go - cmd/docker-mcp/commands/export_test.go - pkg/catalog/catalog_test.go - pkg/gateway/auth_test.go - pkg/gateway/auth_integration_test.go - pkg/gateway/dynamic_mcps_test.go - pkg/gateway/handlers_resource_telemetry_test.go - pkg/migrate/migrate_test.go - pkg/oauth/credhelper_test.go Assisted-By: cagent
Use the modern t.Context() helper instead of context.Background() for test contexts. This provides automatic context cancellation when tests complete or fail. Updated files: - cmd/docker-mcp/commands/catalog_validation_test.go - cmd/docker-mcp/commands/mcpregistry_test.go - cmd/docker-mcp/server/inspect_test.go - cmd/docker-mcp/tools/tools_test.go - pkg/catalog/catalog_test.go - pkg/elicitation_integration_test.go - pkg/gateway/auth_integration_test.go - pkg/gateway/clientpool_test.go - pkg/gateway/configuration_test.go - pkg/gateway/dynamic_mcps_test.go - pkg/gateway/embeddings/client_test.go - pkg/gateway/handlers_prompt_telemetry_test.go - pkg/gateway/handlers_resource_telemetry_test.go - pkg/gateway/handlers_telemetry_test.go - pkg/integration_test.go - pkg/interceptors/github_unauthorized_test.go - pkg/interceptors/interceptors_test.go - pkg/mcp/stdio_test.go - pkg/oauth/callback_server_test.go - pkg/oauth/manager_test.go - pkg/remote_headers_integration_test.go - pkg/telemetry/telemetry_test.go - pkg/toollist_notifications_integration_test.go Assisted-By: cagent
Add forbidigo rules to catch usage of: - context.Background()/context.TODO() in tests (use t.Context()) - os.MkdirTemp() in tests (use t.TempDir()) - os.Setenv() in tests (use t.Setenv()) These rules only apply to *_test.go files via path-except exclusions. Also updated remote_headers_integration_test.go to use t.Cleanup() instead of defer/close pattern to avoid storing context in struct. Note: analyze-types must be enabled for pkg filtering to work. Assisted-By: cagent
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What I did
I tried to use a cagent based agent to modernize the Go unit tests as much as possible.