Skip to content

Commit 90b9171

Browse files
GODRIVER-3444 Add tests for CalculateMaxTimeMS
1 parent 5ccba5d commit 90b9171

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

internal/driverutil/operation_test.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"go.mongodb.org/mongo-driver/v2/internal/assert"
1010
)
1111

12-
//nolint:govet
1312
func TestCalculateMaxTimeMS(t *testing.T) {
1413
tests := []struct {
1514
name string
@@ -41,7 +40,7 @@ func TestCalculateMaxTimeMS(t *testing.T) {
4140
{
4241
name: "remaining timeout < rttMin",
4342
ctx: func() context.Context {
44-
ctx, _ := context.WithDeadline(context.Background(), time.Now().Add(1*time.Millisecond))
43+
ctx, _ := context.WithDeadline(context.Background(), time.Now().Add(1*time.Millisecond)) //nolint:govet
4544
return ctx
4645
}(),
4746
rttMin: 10 * time.Millisecond,
@@ -52,7 +51,7 @@ func TestCalculateMaxTimeMS(t *testing.T) {
5251
{
5352
name: "normal positive result",
5453
ctx: func() context.Context {
55-
ctx, _ := context.WithDeadline(context.Background(), time.Now().Add(100*time.Millisecond))
54+
ctx, _ := context.WithDeadline(context.Background(), time.Now().Add(100*time.Millisecond)) //nolint:govet
5655
return ctx
5756
}(),
5857
wantZero: false,
@@ -62,7 +61,7 @@ func TestCalculateMaxTimeMS(t *testing.T) {
6261
{
6362
name: "beyond maxInt32",
6463
ctx: func() context.Context {
65-
ctx, _ := context.WithDeadline(context.Background(), time.Now().Add(time.Duration(math.MaxInt32+1000)*time.Millisecond))
64+
ctx, _ := context.WithDeadline(context.Background(), time.Now().Add(time.Duration(math.MaxInt32+1000)*time.Millisecond)) //nolint:govet
6665
return ctx
6766
}(),
6867
wantZero: true,
@@ -72,7 +71,7 @@ func TestCalculateMaxTimeMS(t *testing.T) {
7271
{
7372
name: "round up to 1ms",
7473
ctx: func() context.Context {
75-
ctx, _ := context.WithDeadline(context.Background(), time.Now().Add(999*time.Microsecond))
74+
ctx, _ := context.WithDeadline(context.Background(), time.Now().Add(999*time.Microsecond)) //nolint:govet
7675
return ctx
7776
}(),
7877
wantOk: true,

0 commit comments

Comments
 (0)