Skip to content

Commit e784d08

Browse files
committed
Fix minor issues when testing against latest server version.
1 parent c682958 commit e784d08

File tree

4 files changed

+20
-15
lines changed

4 files changed

+20
-15
lines changed

src/MongoDB.Driver.Core/ChangeStreamDocumentSerializer.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,11 @@ protected override ChangeStreamDocument<TDocument> DeserializeValue(BsonDeserial
100100
updateDescription = __updateDescriptionSerializer.Deserialize(context);
101101
break;
102102

103+
case "clusterTime":
104+
// TODO: decide what to do about clusterTime
105+
reader.SkipValue();
106+
break;
107+
103108
default:
104109
throw new FormatException($"Invalid field name: \"{fieldName}\".");
105110
}

tests/MongoDB.Driver.Legacy.Tests/MongoDatabaseTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,11 +484,13 @@ public void TestSetProfilingLevel()
484484
}
485485
}
486486

487-
[Theory]
487+
[SkippableTheory]
488488
[InlineData("user1", "pass1", true)]
489489
[InlineData("user2", "pass2", false)]
490490
public void TestUserMethods(string username, string password, bool isReadOnly)
491491
{
492+
RequireServer.Check().VersionLessThan("3.7.0");
493+
492494
#pragma warning disable 618
493495
bool usesCommands = _primary.Supports(FeatureId.UserManagementCommands);
494496
if (usesCommands)

tests/MongoDB.Driver.Tests/AggregateFluentFacetTests.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public void Facet_with_1_facet_should_return_expected_result()
114114
var result = subject.Facet(facet1).Single();
115115

116116
result.Facets.Select(f => f.Name).Should().Equal("categorizedByTags");
117-
result.Facets[0].Output<BsonDocument>().Should().Equal(
117+
result.Facets[0].Output<BsonDocument>().Should().BeEquivalentTo(
118118
BsonDocument.Parse("{ _id: 'Expressionism', count: 2 }"),
119119
BsonDocument.Parse("{ _id: 'painting', count: 2 }"),
120120
BsonDocument.Parse("{ _id: 'ukiyo-e', count: 1 }"),
@@ -182,7 +182,7 @@ public void Facet_with_2_facets_should_return_expected_result()
182182
var result = subject.Facet(facet1, facet2).Single();
183183

184184
result.Facets.Select(f => f.Name).Should().Equal("categorizedByTags", "categorizedByYears");
185-
result.Facets[0].Output<BsonDocument>().Should().Equal(
185+
result.Facets[0].Output<BsonDocument>().Should().BeEquivalentTo(
186186
BsonDocument.Parse("{ _id: 'Expressionism', count: 2 }"),
187187
BsonDocument.Parse("{ _id: 'painting', count: 2 }"),
188188
BsonDocument.Parse("{ _id: 'ukiyo-e', count: 1 }"),
@@ -192,7 +192,7 @@ public void Facet_with_2_facets_should_return_expected_result()
192192
BsonDocument.Parse("{ _id: 'oil', count: 1 }"),
193193
BsonDocument.Parse("{ _id: 'satire', count: 1 }"),
194194
BsonDocument.Parse("{ _id: 'caricature', count: 1 }"));
195-
result.Facets[1].Output<BsonDocument>().Should().Equal(
195+
result.Facets[1].Output<BsonDocument>().Should().BeEquivalentTo(
196196
BsonDocument.Parse("{ _id: 1900, count: 1 }"),
197197
BsonDocument.Parse("{ _id: 1920, count: 2 }"));
198198
}
@@ -264,7 +264,7 @@ public void Facet_with_3_facets_should_return_expected_result()
264264
var result = subject.Facet(facet1, facet2, facet3).Single();
265265

266266
result.Facets.Select(f => f.Name).Should().Equal("categorizedByTags", "categorizedByYears", "categorizedByYears(Auto)");
267-
result.Facets[0].Output<BsonDocument>().Should().Equal(
267+
result.Facets[0].Output<BsonDocument>().Should().BeEquivalentTo(
268268
BsonDocument.Parse("{ _id: 'Expressionism', count: 2 }"),
269269
BsonDocument.Parse("{ _id: 'painting', count: 2 }"),
270270
BsonDocument.Parse("{ _id: 'ukiyo-e', count: 1 }"),
@@ -274,10 +274,10 @@ public void Facet_with_3_facets_should_return_expected_result()
274274
BsonDocument.Parse("{ _id: 'oil', count: 1 }"),
275275
BsonDocument.Parse("{ _id: 'satire', count: 1 }"),
276276
BsonDocument.Parse("{ _id: 'caricature', count: 1 }"));
277-
result.Facets[1].Output<BsonDocument>().Should().Equal(
277+
result.Facets[1].Output<BsonDocument>().Should().BeEquivalentTo(
278278
BsonDocument.Parse("{ _id: 1900, count: 1 }"),
279279
BsonDocument.Parse("{ _id: 1920, count: 2 }"));
280-
result.Facets[2].Output<BsonDocument>().Should().Equal(
280+
result.Facets[2].Output<BsonDocument>().Should().BeEquivalentTo(
281281
BsonDocument.Parse("{ _id: { min: null, max: 1902 }, count: 1 }"),
282282
BsonDocument.Parse("{ _id: { min: 1902, max: 1925 }, count: 1 }"),
283283
BsonDocument.Parse("{ _id: { min: 1925, max: 1926 }, count: 1 }"),
@@ -327,7 +327,7 @@ public void Facet_typed_with_1_facet_should_return_expected_result()
327327

328328
var result = subject.Facet<Exhibit, CategorizedByTagsResults>(facet1).Single();
329329

330-
result.CategorizedByTags.WithComparer(new CategorizedByTagComparer()).Should().Equal(
330+
result.CategorizedByTags.WithComparer(new CategorizedByTagComparer()).Should().BeEquivalentTo(
331331
new CategorizedByTag { Id = "Expressionism", Count = 2 },
332332
new CategorizedByTag { Id = "painting", Count = 2 },
333333
new CategorizedByTag { Id = "ukiyo-e", Count = 1 },
@@ -396,7 +396,7 @@ public void Facet_typed_with_2_facets_should_return_expected_result()
396396

397397
var result = subject.Facet<Exhibit, CategorizedByTagsAndYearsResults>(facet1, facet2).Single();
398398

399-
result.CategorizedByTags.WithComparer(new CategorizedByTagComparer()).Should().Equal(
399+
result.CategorizedByTags.WithComparer(new CategorizedByTagComparer()).Should().BeEquivalentTo(
400400
new CategorizedByTag { Id = "Expressionism", Count = 2 },
401401
new CategorizedByTag { Id = "painting", Count = 2 },
402402
new CategorizedByTag { Id = "ukiyo-e", Count = 1 },
@@ -406,7 +406,7 @@ public void Facet_typed_with_2_facets_should_return_expected_result()
406406
new CategorizedByTag { Id = "oil", Count = 1 },
407407
new CategorizedByTag { Id = "satire", Count = 1 },
408408
new CategorizedByTag { Id = "caricature", Count = 1 });
409-
result.CategorizedByYears.WithComparer(new CategorizedByYearComparer()).Should().Equal(
409+
result.CategorizedByYears.WithComparer(new CategorizedByYearComparer()).Should().BeEquivalentTo(
410410
new CategorizedByYear { Id = 1900, Count = 1 },
411411
new CategorizedByYear { Id = 1920, Count = 2 });
412412
}
@@ -479,7 +479,7 @@ public void Facet_typed_with_3_facets_should_return_expected_result()
479479

480480
var result = subject.Facet<Exhibit, CategorizedByTagsAndYearsAndYearsAutoResults>(facet1, facet2, facet3).Single();
481481

482-
result.CategorizedByTags.WithComparer(new CategorizedByTagComparer()).Should().Equal(
482+
result.CategorizedByTags.WithComparer(new CategorizedByTagComparer()).Should().BeEquivalentTo(
483483
new CategorizedByTag { Id = "Expressionism", Count = 2 },
484484
new CategorizedByTag { Id = "painting", Count = 2 },
485485
new CategorizedByTag { Id = "ukiyo-e", Count = 1 },
@@ -489,10 +489,10 @@ public void Facet_typed_with_3_facets_should_return_expected_result()
489489
new CategorizedByTag { Id = "oil", Count = 1 },
490490
new CategorizedByTag { Id = "satire", Count = 1 },
491491
new CategorizedByTag { Id = "caricature", Count = 1 });
492-
result.CategorizedByYears.WithComparer(new CategorizedByYearComparer()).Should().Equal(
492+
result.CategorizedByYears.WithComparer(new CategorizedByYearComparer()).Should().BeEquivalentTo(
493493
new CategorizedByYear { Id = 1900, Count = 1 },
494494
new CategorizedByYear { Id = 1920, Count = 2 });
495-
result.CategorizedByYearsAuto.WithComparer(new CategorizedByYearAutoComparer()).Should().Equal(
495+
result.CategorizedByYearsAuto.WithComparer(new CategorizedByYearAutoComparer()).Should().BeEquivalentTo(
496496
new CategorizedByYearAuto { Id = new MinMax { Min = null, Max = 1902 }, Count = 1 },
497497
new CategorizedByYearAuto { Id = new MinMax { Min = 1902, Max = 1925 }, Count = 1 },
498498
new CategorizedByYearAuto { Id = new MinMax { Min = 1925, Max = 1926 }, Count = 1 },

tests/MongoDB.Driver.Tests/Specifications/command-monitoring/tests/find.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@
102102
},
103103
"$returnKey": false,
104104
"$showDiskLoc": false,
105-
"$snapshot": false
106105
}
107106
}
108107
},
@@ -134,7 +133,6 @@
134133
},
135134
"returnKey": false,
136135
"showRecordId": false,
137-
"snapshot": false
138136
},
139137
"command_name": "find",
140138
"database_name": "command-monitoring-tests"

0 commit comments

Comments
 (0)