Skip to content

Conversation

JamesKovacs
Copy link
Contributor

@JamesKovacs JamesKovacs requested a review from jyemin June 10, 2021 21:07
Copy link
Contributor

@jyemin jyemin left a 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.
@JamesKovacs
Copy link
Contributor Author

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:

https://spruce.mongodb.com/version/60c3c19c7742ae54c1a12358/tasks?sorts=STATUS%3AASC%3BBASE_STATUS%3ADESC

That should tell us if I caught everything this time.

@jyemin jyemin requested a review from DmitryLukyanov June 11, 2021 21:24
@JamesKovacs
Copy link
Contributor Author

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...

https://spruce.mongodb.com/version/60c3ef88d1fe0769f894b6f0/tasks?sorts=STATUS%3AASC%3BBASE_STATUS%3ADESC

Copy link
Contributor

@DmitryLukyanov DmitryLukyanov left a 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":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

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.

Copy link
Contributor

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.",
Copy link
Contributor

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

Copy link
Contributor Author

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."};
Copy link
Contributor

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..?

Copy link
Contributor Author

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.

Copy link
Contributor

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
Copy link
Contributor

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

Copy link
Contributor Author

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.");
Copy link
Contributor

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

Copy link
Contributor Author

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.");
Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor

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.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the same as above

Copy link
Contributor Author

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;
Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor

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"))
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good suggestion. Done.

@JamesKovacs
Copy link
Contributor Author

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?

Refactoring isMasterResult is being done as part of CSHARP-3660. It's coming, but not done quite yet.

Copy link
Contributor

@DmitryLukyanov DmitryLukyanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JamesKovacs JamesKovacs merged commit b370f5f into mongodb:master Jun 14, 2021
@JamesKovacs JamesKovacs deleted the csharp3705 branch June 14, 2021 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants