@@ -14,6 +14,7 @@ import (
1414 "regexp"
1515 "sort"
1616 "testing"
17+ "time"
1718
1819 "github.com/10gen/migration-verifier/internal/partitions"
1920 "github.com/10gen/migration-verifier/internal/testutil"
@@ -1236,10 +1237,13 @@ func (suite *IntegrationTestSuite) TestVerifierNamespaceList() {
12361237 suite .ElementsMatch ([]string {"testDb1.testColl1" , "testDb1.testColl2" , "testDb1.testView1" }, verifier .dstNamespaces )
12371238
12381239 // Collections in admin, config, and local should not be found
1239- err = suite .srcMongoClient .Database ("local" ).CreateCollection (ctx , "islocalSrc" )
1240- suite .Require ().NoError (err )
1241- err = suite .dstMongoClient .Database ("local" ).CreateCollection (ctx , "islocalDest" )
1242- suite .Require ().NoError (err )
1240+ if suite .GetSrcTopology () != TopologySharded {
1241+ err = suite .srcMongoClient .Database ("local" ).CreateCollection (ctx , "islocalSrc" )
1242+ suite .Require ().NoError (err )
1243+ err = suite .dstMongoClient .Database ("local" ).CreateCollection (ctx , "islocalDest" )
1244+ suite .Require ().NoError (err )
1245+ }
1246+
12431247 err = suite .srcMongoClient .Database ("admin" ).CreateCollection (ctx , "isAdminSrc" )
12441248 suite .Require ().NoError (err )
12451249 err = suite .dstMongoClient .Database ("admin" ).CreateCollection (ctx , "isAdminDest" )
@@ -1388,19 +1392,22 @@ func (suite *IntegrationTestSuite) TestGenerationalRechecking() {
13881392func (suite * IntegrationTestSuite ) TestVerifierWithFilter () {
13891393 zerolog .SetGlobalLevel (zerolog .DebugLevel )
13901394
1391- filter := map [string ]any {"inFilter" : map [string ]any {"$ne" : false }}
1395+ dbname1 := suite .DBNameForTest ("1" )
1396+ dbname2 := suite .DBNameForTest ("2" )
1397+
1398+ filter := bson.M {"inFilter" : bson.M {"$ne" : false }}
13921399 verifier := suite .BuildVerifier ()
1393- verifier .SetSrcNamespaces ([]string {"testDb1 .testColl1" })
1394- verifier .SetDstNamespaces ([]string {"testDb2 .testColl3" })
1400+ verifier .SetSrcNamespaces ([]string {dbname1 + " .testColl1" })
1401+ verifier .SetDstNamespaces ([]string {dbname2 + " .testColl3" })
13951402 verifier .SetNamespaceMap ()
13961403 verifier .SetIgnoreBSONFieldOrder (true )
13971404 // Set this value low to test the verifier with multiple partitions.
13981405 verifier .partitionSizeInBytes = 50
13991406
14001407 ctx := suite .Context ()
14011408
1402- srcColl := suite .srcMongoClient .Database ("testDb1" ).Collection ("testColl1" )
1403- dstColl := suite .dstMongoClient .Database ("testDb2" ).Collection ("testColl3" )
1409+ srcColl := suite .srcMongoClient .Database (dbname1 ).Collection ("testColl1" )
1410+ dstColl := suite .dstMongoClient .Database (dbname2 ).Collection ("testColl3" )
14041411
14051412 // Documents with _id in [0, 100) should match.
14061413 var docs []interface {}
@@ -1432,7 +1439,11 @@ func (suite *IntegrationTestSuite) TestVerifierWithFilter() {
14321439 suite .Require ().NoError (err )
14331440
14341441 for status .TotalTasks == 0 && verifier .generation < 10 {
1435- suite .T ().Logf ("TotalTasks is 0 (generation=%d); waiting another generation …" , verifier .generation )
1442+ delay := time .Second
1443+
1444+ suite .T ().Logf ("TotalTasks is 0 (generation=%d); waiting %s then will run another generation …" , verifier .generation , delay )
1445+
1446+ time .Sleep (delay )
14361447 checkContinueChan <- struct {}{}
14371448 <- checkDoneChan
14381449 status , err = verifier .GetVerificationStatus ()
@@ -1449,6 +1460,7 @@ func (suite *IntegrationTestSuite) TestVerifierWithFilter() {
14491460 suite .Require ().Equal (status .FailedTasks , 0 )
14501461
14511462 // Insert another document that is not in the filter.
1463+ // This should trigger a recheck despite being outside the filter.
14521464 _ , err = srcColl .InsertOne (ctx , bson.M {"_id" : 200 , "x" : 200 , "inFilter" : false })
14531465 suite .Require ().NoError (err )
14541466
@@ -1457,11 +1469,13 @@ func (suite *IntegrationTestSuite) TestVerifierWithFilter() {
14571469
14581470 // Wait for generation to finish.
14591471 <- checkDoneChan
1472+
14601473 status = waitForTasks ()
1474+
14611475 // There should be no failures, since the inserted document is not in the filter.
14621476 suite .Require ().Equal (VerificationStatus {TotalTasks : 1 , CompletedTasks : 1 }, * status )
14631477
1464- // Now insert in the source, this should come up next generation.
1478+ // Now insert in the source. This should come up next generation.
14651479 _ , err = srcColl .InsertOne (ctx , bson.M {"_id" : 201 , "x" : 201 , "inFilter" : true })
14661480 suite .Require ().NoError (err )
14671481
0 commit comments