Skip to content

Commit 81f961d

Browse files
author
Divjot Arora
committed
Increase deadline for gridfs test when race detector is enabled.
GODRIVER-784 Change-Id: Ide13f9755fabfc5cf72154e36274e523d2223aff
1 parent deab332 commit 81f961d

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

mongo/gridfs/gridfs_test.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"github.com/mongodb/mongo-go-driver/x/bsonx"
2424
"github.com/stretchr/testify/require"
2525

26+
"github.com/mongodb/mongo-go-driver/internal/testutil/israce"
2627
"golang.org/x/net/context"
2728
)
2829

@@ -199,7 +200,13 @@ func TestGridFS(t *testing.T) {
199200
if err != nil {
200201
t.Fatalf("Failed to create bucket: %v", err)
201202
}
202-
err = bucket.SetWriteDeadline(time.Now().Add(5 * time.Second))
203+
204+
timeout := 5 * time.Second
205+
if israce.Enabled {
206+
timeout = 20 * time.Second // race detector causes 2-20x slowdown
207+
}
208+
209+
err = bucket.SetWriteDeadline(time.Now().Add(timeout))
203210
if err != nil {
204211
t.Fatalf("Failed to set write deadline: %v", err)
205212
}

x/network/integration/aggregate_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ import (
1717

1818
"github.com/mongodb/mongo-go-driver/bson"
1919
"github.com/mongodb/mongo-go-driver/internal/testutil"
20+
"github.com/mongodb/mongo-go-driver/internal/testutil/israce"
2021
"github.com/mongodb/mongo-go-driver/mongo/writeconcern"
2122
"github.com/mongodb/mongo-go-driver/x/bsonx"
2223
"github.com/mongodb/mongo-go-driver/x/mongo/driver/topology"
2324
"github.com/mongodb/mongo-go-driver/x/network/address"
2425
"github.com/mongodb/mongo-go-driver/x/network/command"
2526
"github.com/mongodb/mongo-go-driver/x/network/description"
26-
"github.com/mongodb/mongo-go-driver/x/network/integration/internal/israce"
2727
"github.com/stretchr/testify/assert"
2828
)
2929

0 commit comments

Comments
 (0)