WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@RafaelCenzano
Copy link
Contributor

GODRIVER-3573

Summary

  • Removed the old compile check test in favor of new containerized test
  • Updated bash script to compile the project
  • Updated bash script to allow for specific go versions to be tested
  • Replaced use of deprecated function for binding the repo to the container

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.

@RafaelCenzano RafaelCenzano added review-priority-normal Medium Priority PR for Review: within 1 business day ci/cd labels Dec 5, 2025
@mongodb-drivers-pr-bot
Copy link
Contributor

mongodb-drivers-pr-bot bot commented Dec 5, 2025

🧪 Performance Results

Commit SHA: 4c2c5ec

The following benchmark tests for version 693c62e5276cb90007740b67 had statistically significant changes (i.e., |z-score| > 1.96):

Benchmark Measurement % Change Patch Value Stable Region H-Score Z-Score
BenchmarkSingleFindOneByID ops_per_second_min -39.2301 720.0694 Avg: 1184.9104
Med: 1222.1332
Stdev: 165.7684
0.8037 -2.8042

For a comprehensive view of all microbenchmark results for this PR's commit, please check out the Evergreen perf task for this patch.

@mongodb-drivers-pr-bot
Copy link
Contributor

API Change Report

No changes found!

@RafaelCenzano RafaelCenzano changed the title GODRIVER-3573: Remove old duplicate compile check test GODRIVER-3573: Remove old duplicate compilation test Dec 8, 2025
@RafaelCenzano RafaelCenzano force-pushed the GODRIVER-3573 branch 3 times, most recently from 6264939 to 88a9fbf Compare December 9, 2025 21:49
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
@RafaelCenzano RafaelCenzano marked this pull request as ready for review December 9, 2025 22:16
@RafaelCenzano RafaelCenzano requested a review from a team as a code owner December 9, 2025 22:16
Copy link
Contributor

Copilot AI left a 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_VERSIONS environment variable
  • Updated container configuration to use HostConfigModifier instead of deprecated BindMount function

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"
Copy link

Copilot AI Dec 9, 2025

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.

Suggested change
COMPILECHECK_USE_DOCKER: "0"

Copilot uses AI. Check for mistakes.
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$'
Copy link

Copilot AI Dec 9, 2025

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.

Suggested change
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$'

Copilot uses AI. Check for mistakes.
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 ./...
Copy link
Member

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

Comment on lines 11 to 14
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
Copy link
Member

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.

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$'
Copy link
Member

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
Comment on lines 25 to 28
env:
GOWORK: off
GOTOOLCHAIN: auto
GO_VERSIONS: "1.19"
Copy link
Member

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"},
Copy link
Member

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", "./..."})
Copy link
Member

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.

# 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
  })
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/cd review-priority-normal Medium Priority PR for Review: within 1 business day

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants