|
9 | 9 | "github.com/10gen/migration-verifier/internal/util" |
10 | 10 | "github.com/10gen/migration-verifier/mslices" |
11 | 11 | "github.com/pkg/errors" |
| 12 | + "github.com/rs/zerolog" |
12 | 13 | "github.com/samber/lo" |
13 | 14 | "github.com/stretchr/testify/require" |
14 | 15 | "go.mongodb.org/mongo-driver/bson" |
@@ -580,3 +581,49 @@ func (suite *IntegrationTestSuite) TestLargeEvents() { |
580 | 581 | suite.Require().NoError(verifier.WritesOff(ctx)) |
581 | 582 | suite.Require().NoError(verifierRunner.Await()) |
582 | 583 | } |
| 584 | + |
| 585 | +// TestDropMongosyncDB verifies that writes to Mongosync's |
| 586 | +// metadata don’t affect migration-verifier. |
| 587 | +func (suite *IntegrationTestSuite) TestDropMongosyncDB() { |
| 588 | + ctx := suite.Context() |
| 589 | + |
| 590 | + zerolog.SetGlobalLevel(zerolog.TraceLevel) |
| 591 | + |
| 592 | + verifier := suite.BuildVerifier() |
| 593 | + |
| 594 | + dbs := []string{ |
| 595 | + "mongosync_reserved_for_internal_use", |
| 596 | + "mongosync_internal_foo", |
| 597 | + } |
| 598 | + |
| 599 | + for _, dbname := range dbs { |
| 600 | + suite.Require().NoError( |
| 601 | + suite.dstMongoClient. |
| 602 | + Database(dbname). |
| 603 | + CreateCollection(ctx, "foo"), |
| 604 | + ) |
| 605 | + } |
| 606 | + |
| 607 | + verifier.SetVerifyAll(true) |
| 608 | + |
| 609 | + runner := RunVerifierCheck(ctx, suite.T(), verifier) |
| 610 | + suite.Require().NoError(runner.AwaitGenerationEnd()) |
| 611 | + |
| 612 | + for _, dbname := range dbs { |
| 613 | + _, err := suite.dstMongoClient. |
| 614 | + Database(dbname). |
| 615 | + Collection("foo"). |
| 616 | + InsertOne(ctx, bson.D{}) |
| 617 | + suite.Require().NoError(err) |
| 618 | + |
| 619 | + suite.Require().NoError( |
| 620 | + suite.dstMongoClient. |
| 621 | + Database(dbname). |
| 622 | + Drop(ctx), |
| 623 | + ) |
| 624 | + } |
| 625 | + |
| 626 | + suite.Require().NoError(verifier.WritesOff(ctx)) |
| 627 | + |
| 628 | + suite.Require().NoError(runner.Await()) |
| 629 | +} |
0 commit comments