-
Notifications
You must be signed in to change notification settings - Fork 41
feat: enable parallel e2e test execution with dynamic port allocation #137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: enable parallel e2e test execution with dynamic port allocation #137
Conversation
rgarcia
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review in progress
06773db to
ac54a21
Compare
ac54a21 to
da2c63f
Compare
Introduce TestContainer wrapper around testcontainers-go for managing Docker containers with dynamically allocated ports, eliminating port conflicts and enabling parallel test execution. Changes: - Add container.go using testcontainers-go for robust container management - Migrate all e2e tests to use TestContainer instead of global setup - Add t.Parallel() to test functions for concurrent execution - Remove -p 1 from Makefile now that port conflicts are resolved - Replace slog logging with t.Log/t.Logf for cleaner test output Benefits of testcontainers-go over custom implementation: - Docker SDK integration (vs shell commands) - Built-in wait strategies with timeouts - Automatic container cleanup via reaper - Battle-tested library used across the Go ecosystem
da2c63f to
f7417c8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 4 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| } | ||
|
|
||
| for _, tc := range testCases { | ||
| tc := tc // capture range variable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| } | ||
| } | ||
|
|
||
| return exitCode, string(buf), nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused Exec method is never called
Low Severity
The Exec() method on TestContainer is defined but never called anywhere in the codebase. Tests use execCombinedOutputWithClient instead which calls the API endpoint rather than using testcontainers' exec functionality. This unused method adds maintenance burden without providing value.
| // Container returns the underlying testcontainers.Container for advanced usage. | ||
| func (c *TestContainer) Container() testcontainers.Container { | ||
| return c.ctr | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
|
||
| // Build container request options | ||
| opts := []testcontainers.ContainerCustomizer{ | ||
| testcontainers.WithImage(c.Image), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Image specified redundantly in both option and parameter
Low Severity
The container image is specified twice: once via testcontainers.WithImage(c.Image) in the options array (line 61) and again as a direct parameter to testcontainers.Run(ctx, c.Image, opts...) (line 85). This redundancy is confusing and could lead to bugs if one is changed but not the other.
Introduce TestContainer to manage Docker containers with dynamically allocated ports, eliminating port conflicts and enabling parallel test execution. This significantly speeds up CI runs on high-resource machines.
Changes:
Checklist
Note
Medium Risk
Primarily test harness and dependency changes, but it alters how Docker containers are launched/managed and enables parallel execution, which can introduce new CI flakiness and resource/cleanup issues.
Overview
Refactors the e2e suite to run in parallel by introducing a
TestContainerabstraction (based ontestcontainers-go) that starts per-test Docker containers with dynamically mapped API/CDP ports, plus helpers for readiness checks and no-keepalive API clients.Updates the existing e2e tests/benchmarks to use this container wrapper (and
t.Parallel()where applicable), replacing ad-hocdocker run/fixed-port assumptions and switching most logging fromslogtot.Log/b.Log. TheMakefiledropsgo test -p 1and Go module deps are updated to include Docker/testcontainers libraries to support this.Written by Cursor Bugbot for commit f7417c8. This will update automatically on new commits. Configure here.