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: 7176607

The following benchmark tests for version 693c52c10642050007080dfd 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 -85.1829 175.5689 Avg: 1184.9104
Med: 1222.1332
Stdev: 165.7684
0.9096 -6.0889
BenchmarkSingleRunCommand ops_per_second_min -46.7765 815.1793 Avg: 1531.6146
Med: 1581.3327
Stdev: 259.5395
0.8341 -2.7604
BenchmarkSmallDocInsertOne total_bytes_allocated -23.6478 27620840.0000 Avg: 36175576.0000
Med: 36818664.0000
Stdev: 1852643.7337
0.8913 -4.6176
BenchmarkBSONFullDocumentDecoding ops_per_second_min -23.6255 1502.9119 Avg: 1967.8200
Med: 1982.7741
Stdev: 164.7406
0.8095 -2.8221
BenchmarkSmallDocInsertOne total_mem_allocs -23.2647 355617.0000 Avg: 463433.4516
Med: 474976.0000
Stdev: 27219.7353
0.8662 -3.9610
BenchmarkSingleRunCommand ns_per_op 20.7107 165449.0000 Avg: 137062.4000
Med: 134066.0000
Stdev: 8179.9697
0.8555 3.4703
BenchmarkSmallDocInsertOne ns_per_op 15.0764 213920.0000 Avg: 185893.9500
Med: 183806.5000
Stdev: 8548.0713
0.8377 3.2786
BenchmarkSingleRunCommand ops_per_second_med -14.9918 6547.6736 Avg: 7702.4044
Med: 7827.2221
Stdev: 391.4371
0.8246 -2.9500
BenchmarkSingleRunCommand total_mem_allocs -13.9524 913785.0000 Avg: 1061953.1119
Med: 1077155.0000
Stdev: 63567.5334
0.7829 -2.3309
BenchmarkSingleRunCommand total_bytes_allocated -13.7254 84886824.0000 Avg: 98391483.1329
Med: 99644128.0000
Stdev: 5960084.2595
0.7776 -2.2659
BenchmarkSmallDocInsertOne total_time_seconds -12.3402 1.0379 Avg: 1.1841
Med: 1.1848
Stdev: 0.0242
0.9122 -6.0448
BenchmarkSingleFindOneByID total_mem_allocs -10.8975 1477740.0000 Avg: 1658471.6337
Med: 1669130.0000
Stdev: 80981.5511
0.7624 -2.2318
BenchmarkSmallDocInsertOne ops_per_second_max -10.2972 5593.9049 Avg: 6236.0444
Med: 6300.6242
Stdev: 233.1064
0.8056 -2.7547
BenchmarkLargeDocInsertOne total_bytes_allocated -10.2695 32733112.0000 Avg: 36479377.1111
Med: 36901324.0000
Stdev: 1724384.0028
0.7557 -2.1725
BenchmarkSingleFindOneByID total_bytes_allocated -10.1545 92163592.0000 Avg: 102580034.3374
Med: 103269840.0000
Stdev: 5006050.5703
0.7444 -2.0808
BenchmarkSmallDocInsertOne ops_per_second_med -9.7728 5103.3297 Avg: 5656.0879
Med: 5700.4351
Stdev: 241.5862
0.7608 -2.2880
BenchmarkSingleFindOneByID ns_per_op 9.7553 271313.0000 Avg: 247198.0750
Med: 245157.5000
Stdev: 10734.5589
0.7663 2.2465
BenchmarkMultiFindMany ns_per_op 9.6766 2857.0000 Avg: 2604.9302
Med: 2593.0000
Stdev: 118.4120
0.7454 2.1288
BenchmarkLargeDocInsertOne ops_per_second_max -9.2980 5651.5056 Avg: 6230.8474
Med: 6284.0690
Stdev: 231.1983
0.7876 -2.5058
BenchmarkMultiInsertLargeDocument ns_per_op 9.1888 32170447.0000 Avg: 29463130.8621
Med: 29172703.0000
Stdev: 1111537.7406
0.7790 2.4356
BenchmarkBSONDeepDocumentEncoding ns_per_op 8.0918 15917.0000 Avg: 14725.4483
Med: 14881.0000
Stdev: 500.3608
0.7667 2.3814
BenchmarkMultiInsertSmallDocument total_mem_allocs -7.0940 2197287.0000 Avg: 2365063.9000
Med: 2335262.5000
Stdev: 78354.4446
0.7610 -2.1413
BenchmarkBSONFullDocumentDecoding total_bytes_allocated -6.6427 381561688.0000 Avg: 408710995.5000
Med: 408915988.0000
Stdev: 8343280.3944
0.8304 -3.2540
BenchmarkBSONFullDocumentDecoding total_mem_allocs -6.6405 9222259.0000 Avg: 9878221.0625
Med: 9884175.0000
Stdev: 200651.5671
0.8313 -3.2692
BenchmarkBSONFullDocumentDecoding ns_per_op 6.1799 78721.0000 Avg: 74139.2500
Med: 73895.5000
Stdev: 1521.4452
0.8188 3.0114
BenchmarkMultiInsertSmallDocument ns_per_op 5.5120 6723.0000 Avg: 6371.7879
Med: 6347.0000
Stdev: 176.7814
0.7207 1.9867
BenchmarkBSONFlatDocumentDecoding total_mem_allocs -3.9832 10169408.0000 Avg: 10591283.0625
Med: 10634846.5000
Stdev: 213416.5847
0.7225 -1.9768
BenchmarkBSONFlatDocumentDecoding total_bytes_allocated -3.9755 399975992.0000 Avg: 416535277.2500
Med: 418242736.0000
Stdev: 8377777.2824
0.7225 -1.9766
BenchmarkBSONFullDocumentDecoding ops_per_second_med -3.6604 14018.4623 Avg: 14551.0915
Med: 14564.1015
Stdev: 248.6577
0.7483 -2.1420
BenchmarkBSONDeepDocumentDecoding total_time_seconds 0.9487 1.2105 Avg: 1.1991
Med: 1.1988
Stdev: 0.0057
0.7605 2.0125
BenchmarkBSONFlatDocumentDecoding allocated_bytes_per_op 0.0087 18054.0000 Avg: 18052.4375
Med: 18052.0000
Stdev: 0.7594
0.7538 2.0577

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