Skip to content

Commit 5f28ab0

Browse files
committed
Merge branch 'master' into godriver3615
2 parents 0eff704 + 3483773 commit 5f28ab0

180 files changed

Lines changed: 6006 additions & 4017 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.evergreen/config.yml

Lines changed: 20 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ timeout:
2121
binary: bash
2222
args: [ls, -la]
2323
functions:
24-
assume-test-secrets-ec2-role:
25-
- command: ec2.assume_role
26-
params:
27-
role_arn: ${aws_test_secrets_role}
2824
setup-system:
2925
# Executes clone and applies the submitted patch, if any
3026
- command: git.get_project
@@ -502,35 +498,6 @@ functions:
502498
params:
503499
binary: bash
504500
args: ["${DRIVERS_TOOLS}/.evergreen/csfle/await-servers.sh"]
505-
run-kms-tls-test:
506-
- command: subprocess.exec
507-
params:
508-
binary: "bash"
509-
env:
510-
GO_BUILD_TAGS: cse
511-
include_expansions_in_env: [AUTH, SSL, MONGODB_URI, TOPOLOGY, MONGO_GO_DRIVER_COMPRESSOR]
512-
args: [*task-runner, setup-test]
513-
- command: subprocess.exec
514-
type: test
515-
retry_on_failure: true
516-
params:
517-
binary: "bash"
518-
include_expansions_in_env: [KMS_TLS_TESTCASE]
519-
args: [*task-runner, evg-test-kms]
520-
run-custom-aws-credentials-test:
521-
- command: subprocess.exec
522-
params:
523-
binary: "bash"
524-
env:
525-
GO_BUILD_TAGS: cse
526-
include_expansions_in_env: [AUTH, SSL, MONGODB_URI, TOPOLOGY, MONGO_GO_DRIVER_COMPRESSOR]
527-
args: [*task-runner, setup-test]
528-
- command: subprocess.exec
529-
type: test
530-
retry_on_failure: true
531-
params:
532-
binary: "bash"
533-
args: [*task-runner, evg-test-custom-aws-credentials]
534501
run-kmip-tests:
535502
- command: subprocess.exec
536503
params:
@@ -547,23 +514,24 @@ functions:
547514
env:
548515
KMS_MOCK_SERVERS_RUNNING: "true"
549516
args: [*task-runner, evg-test-kmip]
550-
run-retry-kms-requests:
517+
run-client-side-encryption-test:
551518
- command: subprocess.exec
552519
params:
553520
binary: "bash"
554521
env:
555522
GO_BUILD_TAGS: cse
556-
include_expansions_in_env: [AUTH, SSL, MONGODB_URI, TOPOLOGY, MONGO_GO_DRIVER_COMPRESSOR]
523+
include_expansions_in_env: [AUTH, SSL, MONGODB_URI, TOPOLOGY, MONGO_GO_DRIVER_COMPRESSOR, CRYPT_SHARED_LIB_PATH]
557524
args: [*task-runner, setup-test]
558525
- command: subprocess.exec
559526
type: test
560527
retry_on_failure: true
561528
params:
562529
binary: "bash"
563530
env:
531+
KMS_MOCK_SERVERS_RUNNING: "true"
564532
KMS_FAILPOINT_CA_FILE: "${DRIVERS_TOOLS}/.evergreen/x509gen/ca.pem"
565533
KMS_FAILPOINT_SERVER_RUNNING: "true"
566-
args: [*task-runner, evg-test-retry-kms-requests]
534+
args: [*task-runner, evg-test-client-side-encryption]
567535
run-fuzz-tests:
568536
- command: subprocess.exec
569537
type: test
@@ -1422,46 +1390,6 @@ tasks:
14221390
TOPOLOGY: "server"
14231391
AUTH: "noauth"
14241392
SSL: "nossl"
1425-
- name: "test-kms-tls-invalid-cert"
1426-
tags: ["kms-test"]
1427-
commands:
1428-
- func: bootstrap-mongo-orchestration
1429-
vars:
1430-
TOPOLOGY: "server"
1431-
AUTH: "noauth"
1432-
SSL: "nossl"
1433-
- func: start-cse-servers
1434-
- func: run-kms-tls-test
1435-
vars:
1436-
KMS_TLS_TESTCASE: "INVALID_CERT"
1437-
TOPOLOGY: "server"
1438-
AUTH: "noauth"
1439-
SSL: "nossl"
1440-
- name: "test-kms-tls-invalid-hostname"
1441-
tags: ["kms-test"]
1442-
commands:
1443-
- func: bootstrap-mongo-orchestration
1444-
vars:
1445-
TOPOLOGY: "server"
1446-
AUTH: "noauth"
1447-
SSL: "nossl"
1448-
- func: start-cse-servers
1449-
- func: run-kms-tls-test
1450-
vars:
1451-
KMS_TLS_TESTCASE: "INVALID_HOSTNAME"
1452-
TOPOLOGY: "server"
1453-
AUTH: "noauth"
1454-
SSL: "nossl"
1455-
- name: "test-custom-aws-credentials"
1456-
tags: ["kms-test"]
1457-
commands:
1458-
- func: bootstrap-mongo-orchestration
1459-
vars:
1460-
TOPOLOGY: "server"
1461-
AUTH: "noauth"
1462-
SSL: "nossl"
1463-
- func: start-cse-servers
1464-
- func: run-custom-aws-credentials-test
14651393
- name: "test-kms-kmip"
14661394
tags: ["kms-kmip"]
14671395
commands:
@@ -1476,16 +1404,20 @@ tasks:
14761404
TOPOLOGY: "server"
14771405
AUTH: "noauth"
14781406
SSL: "nossl"
1479-
- name: "test-retry-kms-requests"
1480-
tags: ["kms-test"]
1407+
- name: "test-client-side-encryption"
1408+
tags: ["client-side-encryption-test"]
14811409
commands:
14821410
- func: bootstrap-mongo-orchestration
14831411
vars:
1484-
TOPOLOGY: "server"
1412+
TOPOLOGY: "replica_set"
14851413
AUTH: "noauth"
14861414
SSL: "nossl"
14871415
- func: start-cse-servers
1488-
- func: run-retry-kms-requests
1416+
- func: run-client-side-encryption-test
1417+
vars:
1418+
TOPOLOGY: "replica_set"
1419+
AUTH: "noauth"
1420+
SSL: "nossl"
14891421
- name: "testgcpkms-task"
14901422
commands:
14911423
- command: subprocess.exec
@@ -1646,7 +1578,7 @@ axes:
16461578
- id: "windows-64"
16471579
display_name: "Windows 64-bit"
16481580
run_on:
1649-
- windows-vsCurrent-small
1581+
- windows-2022-latest-small
16501582
variables:
16511583
GCC_PATH: "/cygdrive/c/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/bin"
16521584
GO_DIST: "C:\\golang\\go1.25"
@@ -1676,7 +1608,7 @@ axes:
16761608
- id: "windows-64"
16771609
display_name: "Windows 64-bit"
16781610
run_on:
1679-
- windows-vsCurrent-small
1611+
- windows-2022-latest-small
16801612
variables:
16811613
GCC_PATH: "/cygdrive/c/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/bin"
16821614
GO_DIST: "C:\\golang\\go1.25"
@@ -1711,10 +1643,10 @@ axes:
17111643
- id: os-aws-auth
17121644
display_name: OS
17131645
values:
1714-
- id: "windows-64-vsCurrent-latest-small"
1646+
- id: "windows-64-2022-latest-small"
17151647
display_name: "Windows 64-bit"
17161648
run_on:
1717-
- windows-vsCurrent-small
1649+
- windows-2022-latest-small
17181650
variables:
17191651
GCC_PATH: "/cygdrive/c/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/bin"
17201652
GO_DIST: "C:\\golang\\go1.25"
@@ -2112,11 +2044,11 @@ buildvariants:
21122044
display_name: "API Version ${version} ${os-ssl-40}"
21132045
tasks:
21142046
- name: ".versioned-api"
2115-
- matrix_name: "kms-test"
2116-
matrix_spec: {version: ["7.0"], os-ssl-40: ["rhel87-64"]}
2117-
display_name: "KMS TEST ${os-ssl-40}"
2047+
- matrix_name: "client-side-encryption-test"
2048+
matrix_spec: {version: ["latest"], os-ssl-40: ["rhel87-64"]}
2049+
display_name: "Client Side Encryption Tests ${os-ssl-40}"
21182050
tasks:
2119-
- name: ".kms-test"
2051+
- name: ".client-side-encryption-test"
21202052
- matrix_name: "load-balancer-test"
21212053
tags: ["pullrequest"]
21222054
matrix_spec: {version: ["5.0", "6.0", "7.0", "8.0"], os-ssl-40: ["rhel87-64"]}

.golangci.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ linters:
44
enable:
55
- errcheck
66
- gocritic
7-
# TODO(GODRIVER-3712): Enable gosec in golangci-lint version 2.6.2
7+
# TODO(GODRIVER-3712): Enable gosec in golangci-lint version 2.8.0
88
#- gosec
99
- govet
1010
- ineffassign
@@ -61,6 +61,10 @@ linters:
6161
- linters:
6262
- gosec
6363
path: _test\.go
64+
# Ignore prealloc warnings for test files.
65+
- linters:
66+
- prealloc
67+
path: _test\.go
6468
# Ignore missing comments for exported variable/function/type for code in
6569
# the "internal" and "benchmark" directories.
6670
- path: (internal\/|benchmark\/)

.pre-commit-config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ repos:
5353
entry: chmod +x
5454
language: system
5555
types: [shell]
56+
- id: gofumpt
57+
name: gofumpt
58+
entry: gofumpt -w
59+
language: golang
60+
types: [go]
61+
exclude: ^vendor/
62+
additional_dependencies: [mvdan.cc/gofumpt@v0.9.2]
5663
- id: golangci-lint
5764
name: golangci-lint
5865
language: system

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
4343
update-ca-certificates && \
4444
rm -rf /var/lib/apt/lists/*
4545

46+
# Install taskfile
47+
RUN go install github.com/go-task/task/v3/cmd/task@v3.39.2
4648

4749
COPY etc/docker_entry.sh /root/docker_entry.sh
4850
COPY --from=libmongocrypt /root/install /root/install

Taskfile.yml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,15 @@ tasks:
2727
build-compile-check-all: bash etc/run-compile-check-test.sh
2828
build-aws-ecs-test: go test -c ./internal/test/aws -o aws.testbin
2929
check-fmt:
30-
deps: [install-lll]
30+
deps: [install-lll, install-gofumpt]
3131
cmds:
3232
- bash etc/check_fmt.sh
3333
check-modules: bash etc/check_modules.sh
3434
doc: godoc -http=:6060 -index
35-
fmt: go fmt ./...
35+
fmt:
36+
deps: [install-gofumpt]
37+
cmds:
38+
- gofumpt -w .
3639
api-report: bash etc/api_report.sh
3740
install-libmongocrypt:
3841
cmds: [bash etc/install-libmongocrypt.sh]
@@ -90,16 +93,8 @@ tasks:
9093
- go run -race ./internal/cmd/testoidcauth/main.go
9194
evg-test-kmip:
9295
- go test -exec "env PKG_CONFIG_PATH=${PKG_CONFIG_PATH} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} DYLD_LIBRARY_PATH=${MACOS_LIBRARY_PATH}" ${BUILD_TAGS} -v -timeout {{.TEST_TIMEOUT}}s ./internal/integration -run TestClientSideEncryptionSpec/kmipKMS >> test.suite
93-
- go test -exec "env PKG_CONFIG_PATH=${PKG_CONFIG_PATH} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} DYLD_LIBRARY_PATH=${MACOS_LIBRARY_PATH}" ${BUILD_TAGS} -v -timeout {{.TEST_TIMEOUT}}s ./internal/integration -run TestClientSideEncryptionProse/data_key_and_double_encryption >> test.suite
94-
- go test -exec "env PKG_CONFIG_PATH=${PKG_CONFIG_PATH} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} DYLD_LIBRARY_PATH=${MACOS_LIBRARY_PATH}" ${BUILD_TAGS} -v -timeout {{.TEST_TIMEOUT}}s ./internal/integration -run TestClientSideEncryptionProse/corpus >> test.suite
95-
- go test -exec "env PKG_CONFIG_PATH=${PKG_CONFIG_PATH} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} DYLD_LIBRARY_PATH=${MACOS_LIBRARY_PATH}" ${BUILD_TAGS} -v -timeout {{.TEST_TIMEOUT}}s ./internal/integration -run TestClientSideEncryptionProse/custom_endpoint >> test.suite
96-
- go test -exec "env PKG_CONFIG_PATH=${PKG_CONFIG_PATH} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} DYLD_LIBRARY_PATH=${MACOS_LIBRARY_PATH}" ${BUILD_TAGS} -v -timeout {{.TEST_TIMEOUT}}s ./internal/integration -run TestClientSideEncryptionProse/kms_tls_options_test >> test.suite
97-
evg-test-kms:
98-
- go test -exec "env PKG_CONFIG_PATH=${PKG_CONFIG_PATH} LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" ${BUILD_TAGS} -v -timeout {{.TEST_TIMEOUT}}s ./internal/integration -run TestClientSideEncryptionProse/kms_tls_tests >> test.suite
99-
evg-test-custom-aws-credentials:
100-
- go test -exec "env PKG_CONFIG_PATH=${PKG_CONFIG_PATH} LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" ${BUILD_TAGS} -v -timeout {{.TEST_TIMEOUT}}s ./internal/integration -run TestCustomAwsCredentialsProse >> test.suite
101-
evg-test-retry-kms-requests:
102-
- go test -exec "env PKG_CONFIG_PATH=${PKG_CONFIG_PATH} LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" ${BUILD_TAGS} -v -timeout {{.TEST_TIMEOUT}}s ./internal/integration -run TestClientSideEncryptionProse/kms_retry_tests >> test.suite
96+
evg-test-client-side-encryption:
97+
- go test -exec "env PKG_CONFIG_PATH=${PKG_CONFIG_PATH} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} DYLD_LIBRARY_PATH=${MACOS_LIBRARY_PATH}" ${BUILD_TAGS} -v -timeout {{.TEST_TIMEOUT}}s ./internal/integration -run TestClientSideEncryptionProse >> test.suite
10398
evg-test-load-balancers:
10499
# Load balancer should be tested with all unified tests as well as tests in the following
105100
# components: retryable reads, retryable writes, change streams, initial DNS seedlist discovery.
@@ -131,6 +126,12 @@ tasks:
131126
cmds:
132127
- go test ./internal/cmd/benchmark -v --fullRun | tee perf.suite
133128
### Internal tasks. ###
129+
install-gofumpt:
130+
internal: true
131+
cmds:
132+
- go install mvdan.cc/gofumpt@v0.9.2
133+
status:
134+
- command -v gofumpt
134135
install-lll:
135136
internal: true
136137
cmds:

bson/benchmark_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -451,9 +451,11 @@ type codeNode struct {
451451
MeanT int64 `json:"mean_t"`
452452
}
453453

454-
var codeJSON []byte
455-
var codeBSON []byte
456-
var codeStruct codeResponse
454+
var (
455+
codeJSON []byte
456+
codeBSON []byte
457+
codeStruct codeResponse
458+
)
457459

458460
func codeInit() {
459461
f, err := os.Open("testdata/code.json.gz")

bson/bson_corpus_spec_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,5 +497,4 @@ func TestRelaxedUUIDValidation(t *testing.T) {
497497
}
498498
})
499499
}
500-
501500
}

bson/bson_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ func TestMStringer(t *testing.T) {
299299

300300
assert.Equal(t, want, res, "returned string did not unmarshal to the expected document, returned string: %s", got)
301301
}
302+
302303
func TestD_MarshalJSON(t *testing.T) {
303304
t.Parallel()
304305

@@ -562,7 +563,6 @@ func TestMapCodec(t *testing.T) {
562563
err = Unmarshal(doc, &got)
563564
assert.Nil(t, err, "Unmarshal error: %v", err)
564565
assert.Equal(t, mapObj, got, "expected result %v, got %v", mapObj, got)
565-
566566
})
567567

568568
t.Run("keys implements encoding.TextMarshaler and encoding.TextUnmarshaler", func(t *testing.T) {
@@ -581,7 +581,6 @@ func TestMapCodec(t *testing.T) {
581581
err = Unmarshal(doc, &got)
582582
assert.Nil(t, err, "Unmarshal error: %v", err)
583583
assert.Equal(t, mapObj, got, "expected result %v, got %v", mapObj, got)
584-
585584
})
586585
}
587586

bson/bsoncodec.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ import (
1212
"strings"
1313
)
1414

15-
var (
16-
emptyValue = reflect.Value{}
17-
)
15+
var emptyValue = reflect.Value{}
1816

1917
// ValueEncoderError is an error returned from a ValueEncoder when the provided value can't be
2018
// encoded by the ValueEncoder.
@@ -178,8 +176,10 @@ type decodeAdapter struct {
178176
typeDecoderFunc
179177
}
180178

181-
var _ ValueDecoder = decodeAdapter{}
182-
var _ typeDecoder = decodeAdapter{}
179+
var (
180+
_ ValueDecoder = decodeAdapter{}
181+
_ typeDecoder = decodeAdapter{}
182+
)
183183

184184
func decodeTypeOrValueWithInfo(vd ValueDecoder, dc DecodeContext, vr ValueReader, t reflect.Type) (reflect.Value, error) {
185185
if td, _ := vd.(typeDecoder); td != nil {

bson/codec_cache.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ func init() {
2222
}
2323

2424
// statically assert array size
25-
var _ = (kindEncoderCache{}).entries[reflect.UnsafePointer]
26-
var _ = (kindDecoderCache{}).entries[reflect.UnsafePointer]
25+
var (
26+
_ = (kindEncoderCache{}).entries[reflect.UnsafePointer]
27+
_ = (kindDecoderCache{}).entries[reflect.UnsafePointer]
28+
)
2729

2830
type typeEncoderCache struct {
2931
cache sync.Map // map[reflect.Type]ValueEncoder

0 commit comments

Comments
 (0)