Skip to content

Commit 02f048a

Browse files
GODRIVER-3173 Add duration to failure; update tests
1 parent 72a4a0d commit 02f048a

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

internal/integration/unified/schema_version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616

1717
var (
1818
supportedSchemaVersions = map[int]string{
19-
1: "1.22",
19+
1: "1.24",
2020
}
2121
)
2222

testdata/specifications

Submodule specifications updated 48 files

x/mongo/driver/topology/cmap_prose_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ func TestCMAPProse(t *testing.T) {
362362
assert.Equal(t, conn.driverConnectionID, failed[0].ConnectionID)
363363
assert.Equal(t, requestID, failed[0].RequestID)
364364
assert.Equal(t, "error", failed[0].Reason)
365+
assert.Greater(t, int(failed[0].Duration), 0)
365366
assert.ErrorIs(t, failed[0].Error, io.EOF)
366367

367368
// There should be 0 ConnectionPendingResponseSucceeded event.

x/mongo/driver/topology/pool.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,7 @@ func publishPendingResponseStarted(pool *pool, conn *connection) {
820820
}
821821
}
822822

823-
func publishPendingResponseFailed(pool *pool, conn *connection, err error) {
823+
func publishPendingResponseFailed(pool *pool, conn *connection, dur time.Duration, err error) {
824824
prs := conn.pendingResponseState
825825
if prs == nil {
826826
return
@@ -850,6 +850,7 @@ func publishPendingResponseFailed(pool *pool, conn *connection, err error) {
850850
RequestID: prs.requestID,
851851
Reason: reason,
852852
Error: err,
853+
Duration: dur,
853854
}
854855
pool.monitor.Event(e)
855856
}
@@ -1028,7 +1029,8 @@ func awaitPendingResponse(ctx context.Context, pool *pool, conn *connection) err
10281029
// operations. This is likely a bug in the Go Driver. So it's possible that
10291030
// the connection is idle at the point of check-in.
10301031
defer func() {
1031-
publishPendingResponseFailed(pool, conn, err)
1032+
dur := time.Since(st)
1033+
publishPendingResponseFailed(pool, conn, dur, err)
10321034

10331035
_ = pool.checkInNoEvent(conn)
10341036
}()

0 commit comments

Comments
 (0)