Skip to content

Commit e9a0ce1

Browse files
authored
GODRIVER-2072 Add race detector Evergreen variant. (#1110)
1 parent 71831b2 commit e9a0ce1

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

.evergreen/config.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1570,6 +1570,21 @@ tasks:
15701570
- func: run-load-balancer
15711571
- func: run-load-balancer-tests
15721572

1573+
- name: test-race
1574+
tags: ["race"]
1575+
commands:
1576+
- func: bootstrap-mongo-orchestration
1577+
vars:
1578+
TOPOLOGY: "replica_set"
1579+
AUTH: "noauth"
1580+
SSL: "nossl"
1581+
- func: run-tests
1582+
vars:
1583+
TOPOLOGY: "replica_set"
1584+
AUTH: "noauth"
1585+
SSL: "nossl"
1586+
RACE: "-race"
1587+
15731588
- name: test-replicaset-noauth-nossl
15741589
tags: ["test", "replicaset"]
15751590
commands:
@@ -2377,6 +2392,12 @@ buildvariants:
23772392
# macos MongoDB servers do not staple OCSP responses and only support RSA.
23782393
- name: ".ocsp-rsa !.ocsp-staple"
23792394

2395+
- matrix_name: "race-test"
2396+
matrix_spec: { version: ["latest"], os-ssl-40: ["ubuntu1804-64-go-1-18"] }
2397+
display_name: "Race Detector Test"
2398+
tasks:
2399+
- name: ".race"
2400+
23802401
- matrix_name: "versioned-api-test"
23812402
matrix_spec: { version: ["5.0", "6.0", "latest"], os-ssl-40: "*" }
23822403
display_name: "API Version ${version} ${os-ssl-40}"

.evergreen/run-tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ MONGO_GO_DRIVER_PKCS8_UNENCRYPTED_KEY_FILE=${MONGO_GO_DRIVER_PKCS8_UNENCRYPTED_K
117117
MONGODB_URI="${MONGODB_URI}" \
118118
TOPOLOGY=${TOPOLOGY} \
119119
MONGO_GO_DRIVER_COMPRESSOR=${MONGO_GO_DRIVER_COMPRESSOR} \
120-
BUILD_TAGS="-tags ${GO_BUILD_TAGS}" \
120+
BUILD_TAGS="${RACE} -tags ${GO_BUILD_TAGS}" \
121121
AWS_ACCESS_KEY_ID="${AWS_ACCESS_KEY_ID}" \
122122
AWS_SECRET_ACCESS_KEY="${AWS_SECRET_ACCESS_KEY}" \
123123
AWS_DEFAULT_REGION="us-east-1" \

internal/uuid/uuid_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,18 @@ import (
1111
"testing"
1212

1313
"github.com/stretchr/testify/require"
14+
"go.mongodb.org/mongo-driver/internal/testutil/israce"
1415
)
1516

1617
// GODRIVER-2349
1718
// Test that initializing many package-global UUID sources concurrently never leads to any duplicate
1819
// UUIDs being generated.
1920
func TestGlobalSource(t *testing.T) {
2021
t.Run("exp rand 1 UUID x 1,000,000 goroutines using a global source", func(t *testing.T) {
22+
if israce.Enabled {
23+
t.Skip("skipping as race detector is enabled and test exceeds 8128 goroutine limit")
24+
}
25+
2126
// Read a UUID from each of 1,000,000 goroutines and assert that there is never a duplicate value.
2227
const iterations = 1e6
2328
uuids := new(sync.Map)
@@ -36,6 +41,10 @@ func TestGlobalSource(t *testing.T) {
3641
wg.Wait()
3742
})
3843
t.Run("exp rand 1 UUID x 1,000,000 goroutines each initializing a new source", func(t *testing.T) {
44+
if israce.Enabled {
45+
t.Skip("skipping as race detector is enabled and test exceeds 8128 goroutine limit")
46+
}
47+
3948
// Read a UUID from each of 1,000,000 goroutines and assert that there is never a duplicate value.
4049
// The goal is to emulate many separate Go driver processes starting at the same time and
4150
// initializing the uuid package at the same time.

0 commit comments

Comments
 (0)