Skip to content

Commit a4086df

Browse files
committed
Fix test to accommodate inter-shard “noise” that advances cluster time.
1 parent 8140003 commit a4086df

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

internal/verifier/change_stream_test.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,13 @@ func (suite *IntegrationTestSuite) TestStartAtTimeWithChanges() {
162162
suite.Require().NotNil(origSessionTime)
163163
err = verifier.StartChangeStream(ctx)
164164
suite.Require().NoError(err)
165-
suite.Require().Equal(verifier.srcStartAtTs, origSessionTime)
165+
166+
// srcStartAtTs derives from the change stream’s resume token, which can
167+
// postdate our session time but should not precede it.
168+
suite.Require().False(
169+
verifier.srcStartAtTs.Before(*origSessionTime),
170+
"srcStartAtTs should be >= the insert’s optime",
171+
)
166172

167173
_, err = suite.srcMongoClient.Database("testDb").Collection("testColl").InsertOne(
168174
sctx, bson.D{{"_id", 1}})

0 commit comments

Comments
 (0)