Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update the rest of the connection string spec tests
  • Loading branch information
jyemin committed Jun 12, 2024
commit 60963664eb1a7079c894a1926ba374b0d4e17a1c
11 changes: 6 additions & 5 deletions driver-core/src/test/resources/connection-string/valid-auth.json
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@
},
{
"description": "Subdelimiters in user/pass don't need escaping (MONGODB-CR)",
"uri": "mongodb://!$&'()*,;=:!$&'()*,;=@127.0.0.1/admin?authMechanism=MONGODB-CR",
"uri": "mongodb://!$&'()*+,;=:!$&'()*+,;=@127.0.0.1/admin?authMechanism=MONGODB-CR",
"valid": true,
"warning": false,
"hosts": [
Expand All @@ -253,8 +253,8 @@
}
],
"auth": {
"username": "!$&'()*,;=",
"password": "!$&'()*,;=",
"username": "!$&'()*+,;=",
"password": "!$&'()*+,;=",
"db": "admin"
},
"options": {
Expand Down Expand Up @@ -284,7 +284,7 @@
},
{
"description": "Escaped username (GSSAPI)",
"uri": "mongodb://user%40EXAMPLE.COM:secret@localhost/?authMechanismProperties=SERVICE_NAME:other,CANONICALIZE_HOST_NAME:true&authMechanism=GSSAPI",
"uri": "mongodb://user%40EXAMPLE.COM:secret@localhost/?authMechanismProperties=SERVICE_NAME:other,CANONICALIZE_HOST_NAME:forward,SERVICE_HOST:example.com&authMechanism=GSSAPI",
"valid": true,
"warning": false,
"hosts": [
Expand All @@ -303,7 +303,8 @@
"authmechanism": "GSSAPI",
"authmechanismproperties": {
"SERVICE_NAME": "other",
"CANONICALIZE_HOST_NAME": true
"SERVICE_HOST": "example.com",
"CANONICALIZE_HOST_NAME": "forward"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,21 @@
"auth": null,
"options": null
},
{
"description": "Unix domain socket (mixed case)",
"uri": "mongodb://%2Ftmp%2FMongoDB-27017.sock",
"valid": true,
"warning": false,
"hosts": [
{
"type": "unix",
"host": "/tmp/MongoDB-27017.sock",
"port": null
}
],
"auth": null,
"options": null
},
{
"description": "Unix domain socket (absolute path with spaces in path)",
"uri": "mongodb://%2Ftmp%2F %2Fmongodb-27017.sock",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,21 @@
"auth": null,
"options": null
},
{
"description": "Unix domain socket (mixed case)",
"uri": "mongodb://rel%2FMongoDB-27017.sock",
"valid": true,
"warning": false,
"hosts": [
{
"type": "unix",
"host": "rel/MongoDB-27017.sock",
"port": null
}
],
"auth": null,
"options": null
},
{
"description": "Unix domain socket (relative path with spaces)",
"uri": "mongodb://rel%2F %2Fmongodb-27017.sock",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,51 @@
"options": {
"wtimeoutms": 10
}
},
{
"description": "Empty integer option values are ignored",
"uri": "mongodb://localhost/?maxIdleTimeMS=",
"valid": true,
"warning": true,
"hosts": [
{
"type": "hostname",
"host": "localhost",
"port": null
}
],
"auth": null,
"options": null
},
{
"description": "Empty boolean option value are ignored",
"uri": "mongodb://localhost/?journal=",
"valid": true,
"warning": true,
"hosts": [
{
"type": "hostname",
"host": "localhost",
"port": null
}
],
"auth": null,
"options": null
},
{
"description": "Comma in a key value pair causes a warning",
"uri": "mongodb://example.com?authMechanismProperties=TOKEN_RESOURCE:mongodb://host1%2Chost2",
"valid": true,
"warning": true,
"hosts": [
{
"type": "hostname",
"host": "example.com",
"port": null
}
],
"auth": null,
"options": null
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import java.util.Collection;
import java.util.List;

import static org.junit.Assume.assumeFalse;

// See https://github.com/mongodb/specifications/tree/master/source/connection-string/tests
public class ConnectionStringTest extends AbstractConnectionStringTest {
public ConnectionStringTest(final String filename, final String description, final String input, final BsonDocument definition) {
Expand All @@ -37,6 +39,7 @@ public ConnectionStringTest(final String filename, final String description, fin

@Test
public void shouldPassAllOutcomes() {
assumeFalse(getDescription().equals("Empty integer option values are ignored"));
if (getFilename().equals("invalid-uris.json")) {
testInvalidUris();
} else if (getFilename().equals("valid-auth.json")) {
Expand Down