-
Notifications
You must be signed in to change notification settings - Fork 919
GODRIVER-3573: Remove old duplicate compilation test #2257
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
base: master
Are you sure you want to change the base?
Conversation
🧪 Performance ResultsCommit SHA: 7176607The following benchmark tests for version 693c52c10642050007080dfd had statistically significant changes (i.e., |z-score| > 1.96):
For a comprehensive view of all microbenchmark results for this PR's commit, please check out the Evergreen perf task for this patch. |
API Change ReportNo changes found! |
6264939 to
88a9fbf
Compare
cleanup gitignore remove cmd/compilecheck from Taskfile
and allow compile test on specific versions resolve deprecated BindMount function call remove unwanted files
add docker dependency as direct dep for compilecheck
Go 1.19 is the current minimum supporter Go version set go toolchain to auto to allow proper version to be downloaded for build
This is to allow the test to continue to work until GODRIVER-3723
88a9fbf to
53192c1
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.
Pull request overview
This PR removes duplicate compilation tests by eliminating the old internal/cmd/compilecheck test in favor of the newer containerized test in internal/test/compilecheck. The changes improve test flexibility by allowing developers to specify Go versions via environment variables and update the container binding mechanism to use the non-deprecated HostConfigModifier API.
- Removed old compilation test directory and associated files
- Enhanced containerized test to support configurable Go versions via
GO_VERSIONSenvironment variable - Updated container configuration to use
HostConfigModifierinstead of deprecatedBindMountfunction
Reviewed changes
Copilot reviewed 10 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
internal/test/compilecheck/compile_check_test.go |
Refactored to inline test code, use HostConfigModifier for volume binding, and support configurable Go versions through environment variable |
internal/test/compilecheck/go.mod |
Promoted github.com/docker/docker from indirect to direct dependency |
internal/cmd/compilecheck/main.go |
Deleted old test main file |
internal/cmd/compilecheck/go.mod |
Deleted old test module file |
internal/cmd/compilecheck/go.sum |
Deleted old test dependencies file |
internal/cmd/compilecheck/go.work |
Deleted old workspace file |
etc/compile_check.sh |
Deleted old bash script for compilation checks |
etc/run-compile-check-test.sh |
Updated to support configurable Go versions with default fallback |
go.work |
Removed reference to deleted internal/cmd/compilecheck directory |
Taskfile.yml |
Replaced build-compile-check task with compilecheck-119 using containerized test |
.github/workflows/codeql.yml |
Updated to run containerized compile check inline instead of using Taskfile |
.gitignore |
Removed entries for deleted compilation check binaries |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Taskfile.yml
Outdated
| GOWORK: off | ||
| GOTOOLCHAIN: auto | ||
| GO_VERSIONS: "1.19" | ||
| COMPILECHECK_USE_DOCKER: "0" |
Copilot
AI
Dec 9, 2025
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.
The environment variable COMPILECHECK_USE_DOCKER is set but never used in the test code. This appears to be dead code that should be removed to avoid confusion.
| COMPILECHECK_USE_DOCKER: "0" |
.github/workflows/codeql.yml
Outdated
| go build ${BUILD_TAGS} ./... | ||
| go test -short ${BUILD_TAGS} -run ^$$ ./... | ||
| GO_VERSIONS="1.19" go test -v ./internal/test/compilecheck -run '^TestCompileCheck/golang:1.19$' |
Copilot
AI
Dec 9, 2025
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.
The compile check test should be run with GOWORK=off to match the configuration in the Taskfile (line 26) and the bash script at etc/run-compile-check-test.sh (line 18). Without this, the test may use workspace settings which could affect the compilation test behavior.
| GO_VERSIONS="1.19" go test -v ./internal/test/compilecheck -run '^TestCompileCheck/golang:1.19$' | |
| GOWORK=off GO_VERSIONS="1.19" go test -v ./internal/test/compilecheck -run '^TestCompileCheck/golang:1.19$' |
Remove COMPILECHECK_USE_DOCKER as it is unused Add GO_WORK=off to compilecheck test
| GOTOOLCHAIN: local | ||
| run: | | ||
| # TODO(GODRIVER-3723): Run using taskfile targets. | ||
| go build ./... |
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.
[blocking] We need to include the libmongocrypt task before building:
task install-libmongocrypt
If this doesn't work, try running the script manually:
bash etc/install-libmongocrypt.sh
test -d install || test -d /cygdrive/c/libmongocrypt/bin
If we have to do the latter, we should remove taskfile support:
- name: Install Taskfile support
uses: arduino/setup-task@v2
etc/run-compile-check-test.sh
Outdated
| if [ -z "${GO_VERSIONS:-}" ]; then | ||
| GO_VERSIONS="1.19,1.20,1.21,1.22,1.23,1.24,1.25" | ||
| fi | ||
| export GO_VERSIONS |
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.
[blocking] We should move the go versions to the compile check test. If we need to run a specific version(s), we can do that with the test name:
GO_WORK=off GO_VERSIONS="1.19" go test -v ./internal/test/compilecheck -run '^TestCompileCheck/golang:1.19$'GO_VERSIONS="1.19" is a redundancy, 1.19 is already specified in the name regex.
.github/workflows/codeql.yml
Outdated
| go build ${BUILD_TAGS} ./... | ||
| go test -short ${BUILD_TAGS} -run ^$$ ./... | ||
| GO_WORK=off GO_VERSIONS="1.19" go test -v ./internal/test/compilecheck -run '^TestCompileCheck/golang:1.19$' |
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.
[blocking] The environment variable is defined in the specifications as GOWORK. Is GO_WORK=off working?
Taskfile.yml
Outdated
| env: | ||
| GOWORK: off | ||
| GOTOOLCHAIN: auto | ||
| GO_VERSIONS: "1.19" |
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.
[question] Can we lose all these env variables?
| Mounts: []testcontainers.ContainerMount{ | ||
| testcontainers.BindMount(rootDir, "/workspace"), | ||
| Image: image, | ||
| Cmd: []string{"tail", "-f", "/dev/null"}, |
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.
[nit] Can we add a note about what this does? Something like "keep container running to Exec commands into it"?
| } | ||
|
|
||
| // Standard build. | ||
| exitCode, outputReader, err := container.Exec(context.Background(), []string{"go", "build", "./..."}) |
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.
[blocking] We also need to include dynamic linking, building with tags, and building with various architectures.
mongo-go-driver/etc/compile_check.sh
Lines 33 to 42 in ad40e61
| # Dynamic linking | |
| $BUILD_CMD -buildmode=plugin | |
| # Check build with tags. | |
| [[ -n "$BUILD_TAGS" ]] && $BUILD_CMD $BUILD_TAGS ./... | |
| # Check build with various architectures. | |
| for ARCH in "${ARCHITECTURES[@]}"; do | |
| GOOS=linux GOARCH=$ARCH $BUILD_CMD ./... | |
| done |
Build tags can be env-dependent. The architectures should be subtests:
archTests := []string{"amd64", "arm64", /* etc */}
for _, arch := range archTests {
t.Run(fmt.Sprintf("GOARCH=%s", arch), func(t *testing.T) {
// TODO
})
}Add more supported linux architectures Add dynamic linking compilation check
GODRIVER-3573
Summary
Background & Motivation
A new compilation test was created using container in #1992 for GODRIVER-3493. There was duplicate tests for testing compilation across supported go versions. This PR removes the old test and updates the new one to allow for more flexibility for testing if a developer needs it.