-
Notifications
You must be signed in to change notification settings - Fork 1.3k
CSHARP-3705: Ignore hello commands during event capture for UnifiedTestRunner. #548
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM once test runs confirm it.
…tests related to not-yet-implemented load balancer support.
The initial patch revealed additional failures. All fixes are in the test runner code, not production code. These fixes ran cleanly on a 5.0-rc0 replset with and without auth locally. Running full patch on latest in Evergreen: That should tell us if I caught everything this time. |
… output from 5.0 sharded clusters.
Evergreen found failures on 5.0 sharded clusters because the query team changed the explain plan format for sharded clusters. Some of our tests were looking for explain plan output in the wrong place and failing with a null reference on 5.0 sharded clusters only. Let's see if this patch reports green... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we make anything with isMasterResult also? like wrap it to HelloResult and use a new class in the code instead. Will we be able just to remove isMasterResult in 3.0 without depricating this class now?
@@ -222,6 +222,11 @@ private bool CanRunOn(ICluster cluster, BsonDocument requirement) | |||
{ | |||
switch (item.Name) | |||
{ | |||
case "authEnabled": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should it be just auth
like here: https://github.com/mongodb/specifications/blob/master/source/load-balancers/tests/sdam-error-handling.json#L324?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
authEnabled
is a new field being added with the updated SDAM spec tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, it's for non-unified format, it would be good if when we add a new logic to both old and new formats, we tried to choose similar keys :)
@@ -529,7 +530,8 @@ private ICluster BuildCluster(BsonDocument definition) | |||
private class TestCaseFactory : JsonDrivenTestCaseFactory | |||
{ | |||
// private constants | |||
private const string MonitoringPrefix = "MongoDB.Driver.Core.Tests.Specifications.server_discovery_and_monitoring.tests.monitoring."; | |||
private readonly string[] MonitoringPrefixes = {"MongoDB.Driver.Core.Tests.Specifications.server_discovery_and_monitoring.tests.monitoring.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
private readonly string[] MonitoringPrefixes =
{
"MongoDB.Driver.Core.Tests.Specifications.server_discovery_and_monitoring.tests.monitoring.",
"MongoDB.Driver.Core.Tests.Specifications.server_discovery_and_monitoring.tests.legacy_hello.monitoring."
};
but in any case we use a space between {
and inner content
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
@@ -529,7 +530,8 @@ private ICluster BuildCluster(BsonDocument definition) | |||
private class TestCaseFactory : JsonDrivenTestCaseFactory | |||
{ | |||
// private constants | |||
private const string MonitoringPrefix = "MongoDB.Driver.Core.Tests.Specifications.server_discovery_and_monitoring.tests.monitoring."; | |||
private readonly string[] MonitoringPrefixes = {"MongoDB.Driver.Core.Tests.Specifications.server_discovery_and_monitoring.tests.monitoring.", | |||
"MongoDB.Driver.Core.Tests.Specifications.server_discovery_and_monitoring.tests.legacy_hello.monitoring."}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where is this line from, i don't see it in the spec..?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is in the updated specs. I had spec updates in CSHARP-3660 mixed in with C# code fixes to make them work. But then the PR was going to be painful to review because there were thousands of spec changes (which had already been reviewed as part of DRIVERS-1293) mixed in with C# code changes. Some of those changes were necessary here to get tests passing. Rather than try to disentangle the C# changes necessary to fix the existing spec tests and the C# changes necessary to fix the updated spec tests, I just moved all the C# changes to this ticket for easier review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my question was about this folder legacy_hello
that I didn't find in the spec master. Also If this is a folder with old tests, I would expect naming like legacy
similar to we have in other places (maybe it's out of the scope here)
return base.ShouldReadJsonDocument(path) && !path.StartsWith(MonitoringPrefix); | ||
return base.ShouldReadJsonDocument(path) && | ||
!MonitoringPrefixes.Any(prefix => path.StartsWith(prefix)) && | ||
!path.EndsWith("discover_load_balancer.json"); // load balancer support not yet implemented |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's better to disable the whole folder rather than individual files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough point. I'll skip the folder instead.
@@ -114,6 +115,7 @@ public JsonDrivenTest CreateTest(string receiver, string name) | |||
switch (name) | |||
{ | |||
case "listDatabaseNames": return new JsonDrivenListDatabaseNamesTest(_client, _objectMap); | |||
case "listDatabaseObjects": throw new SkipException(".NET/C# driver does not implement a ListDatabaseObjects helper."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where this option come from? I don't see it in the specs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This option is coming from the updated retryable reads spec tests, which will be merged after this PR.
@@ -138,6 +140,7 @@ public JsonDrivenTest CreateTest(string receiver, string name) | |||
case "createCollection": return new JsonDrivenCreateCollectionTest(database, _objectMap); | |||
case "dropCollection": return new JsonDrivenDropCollectionTest(database, _objectMap); | |||
case "listCollectionNames": return new JsonDrivenListCollectionNamesTest(database, _objectMap); | |||
case "listCollectionObjects": throw new SkipException(".NET/C# driver does not implement a ListCollectionObjects helper."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the same as above, I don't see this key in the spec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This option is coming from the updated retryable reads spec tests, which will be merged after this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, this option looks like this one: https://github.com/mongodb/specifications/blob/master/source/unified-test-format/unified-test-format.rst#listcollections (that I already implemented in load balanced PR), is it different step?
@@ -168,6 +171,7 @@ public JsonDrivenTest CreateTest(string receiver, string name) | |||
case "insertMany": return new JsonDrivenInsertManyTest(collection, _objectMap); | |||
case "insertOne": return new JsonDrivenInsertOneTest(collection, _objectMap); | |||
case "listIndexes": return new JsonDrivenListIndexesTest(collection, _objectMap); | |||
case "listIndexNames": throw new SkipException(".NET/C# driver does not implement a ListIndexNames helper."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This option is coming from the updated retryable reads spec tests, which will be merged after this PR.
@@ -18,7 +18,6 @@ | |||
using System.Threading.Tasks; | |||
using MongoDB.Bson; | |||
using MongoDB.Bson.TestHelpers.JsonDrivenTests; | |||
using MongoDB.Driver; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: we usually don't leave such small changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was an unused using. Figured I'd remove it since I was making other edits in the same set of files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't do it because it makes a git history a bit messy (you didn't make any valuable changes in the file but you see this file in the log), but it's minor anyway
@@ -51,6 +51,11 @@ public sealed class UnifiedTestRunner : IDisposable | |||
|
|||
public void Run(JsonDrivenTestCase testCase) | |||
{ | |||
if (testCase.Name.Contains("mongos-unpin.json")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add this on the particular runner level?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good suggestion. Done.
Refactoring |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Running patch on latest to verify the fix:
https://spruce.mongodb.com/version/60c27902d1fe0735af1ee280/tasks?sorts=STATUS%3AASC%3BBASE_STATUS%3ADESC