[CSHARP-3951] Get all tests to pass against a cluster with two mongos routers and default configurations Created: 02/Nov/21  Updated: 27/Oct/23  Resolved: 02/Dec/21

Status: Closed
Project: C# Driver
Component/s: Testing
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Unknown
Reporter: Robert Stam Assignee: Unassigned
Resolution: Works as Designed Votes: 0
Labels: green-build-friday
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to CSHARP-3948 Add support for FLE_MONGOCRYPTD_PORT ... Closed

 Description   

There are a number of tests that fail when run against a sharded cluster with two mongos routers and default configurations.

The main cause of failure is that a sharded cluster started by mlaunch uses consecutive port numbers. Notice in particular (below) that the cluster is using port 27020. This conflicts with `mongocrypt` also defaulting to use port 27020.

While mlaunch can be told to use a different port range, that then in turn requires temporarily setting up the `MONGODB_URI` and `MONGODB_URI_WITH_MULTIPLE_MONGOSES` which requires a number of manual steps to set, load, unset and unload. The preferred scenario is that the tests should all pass using a default mlaunch sharded cluster configuration and the default connection strings built into the test suite.

To reproduce start a cluster with mlaunch like this:

mlaunch init --sharded 1 --replicaset --nodes 1 --mongos 2 --binarypath C:\mongodb\v5.0.3\bin --setParameter enableTestCommands=true 

which results in the following cluster configuration:

PS C:\mlaunch\v5.0.3\sharded> mlaunch list
 
PROCESS          PORT     STATUS     PID
 
mongos           27017    running    16132
mongos           27018    running    3660
 
config server    27020    running    27964
 
shard01
    mongod       27019    running    26732
 
 
PS C:\mlaunch\v5.0.3\sharded>

 Then run the tests using:

.\build.ps1 --target=testnet472 // or test 

The tests should be run using the default connection strings built into the test suite. In other words, the `MONGODB_URI` and `MONGODB_URI_WITH_MULTIPLE_MONGOSES` environment variables should not be set.



 Comments   
Comment by Robert Stam [ 02/Dec/21 ]

I have confirmed that now that CSHARP-3948 is done all tests pass against a sharded configuration with 2 mongoses using the standard ports chosen by default by mlaunch, as long as the `FLE_MONGOCRYPTD_PORT` environment variable is set to a suitable value that prevents the conflict on port 27020.

This ticket can be closed with no further work.

Comment by Robert Stam [ 02/Nov/21 ]

Solving the conflict over port 27020 obviously requires some type of configuration to avoid the conflict.

The first possible configuration was mentioned above: tell mlaunch to use a different port range and set the `MONGODB_URI` and `MONGODB_URI_WITH_MULTIPLE_MONGOSES` environment variable. This clearly works but is awkward because you have to remember to set the environment variables and you also have to remember to unset them when switching to test against other clusters you might spin up that use the default port of 27017.

The second possible configuration is to configure all uses of `mongocryptd` to use a different port. This would be great because you could set an environment variable to do that once and then forget about it. It would never have to be changed or unset. That's what CSHARP-3948 is about.

If CSHARP-3948 is done this ticket might not need any further work.

Generated at Wed Feb 07 21:46:46 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.