diff --git a/source/uri-options/tests/connection-options.json b/source/uri-options/tests/connection-options.json index bbaa295ecb..fac60bd6ee 100644 --- a/source/uri-options/tests/connection-options.json +++ b/source/uri-options/tests/connection-options.json @@ -268,6 +268,92 @@ "hosts": null, "auth": null, "options": null + }, + { + "description": "timeoutMS with large value", + "uri": "mongodb://example.com/?timeoutMS=100000", + "valid": true, + "warning": false, + "hosts": null, + "auth": null, + "options": { + "timeoutMS": 100000 + } + }, + { + "description": "timeoutMS with SRV URI", + "uri": "mongodb+srv://test1.test.build.10gen.cc/?timeoutMS=5000", + "valid": true, + "warning": false, + "hosts": null, + "auth": null, + "options": { + "timeoutMS": 5000 + } + }, + { + "description": "Valid appname is parsed correctly", + "uri": "mongodb://example.com/?appname=MyApplication", + "valid": true, + "warning": false, + "hosts": null, + "auth": null, + "options": { + "appname": "MyApplication" + } + }, + { + "description": "Empty appname is parsed correctly", + "uri": "mongodb://example.com/?appname=", + "valid": true, + "warning": false, + "hosts": null, + "auth": null, + "options": { + "appname": "" + } + }, + { + "description": "retryReads=true is parsed correctly", + "uri": "mongodb://example.com/?retryReads=true", + "valid": true, + "warning": false, + "hosts": null, + "auth": null, + "options": { + "retryReads": true + } + }, + { + "description": "retryReads=false is parsed correctly", + "uri": "mongodb://example.com/?retryReads=false", + "valid": true, + "warning": false, + "hosts": null, + "auth": null, + "options": { + "retryReads": false + } + }, + { + "description": "Invalid retryReads causes a warning", + "uri": "mongodb://example.com/?retryReads=invalid", + "valid": true, + "warning": true, + "hosts": null, + "auth": null, + "options": null + }, + { + "description": "retryWrites=false is parsed correctly", + "uri": "mongodb://example.com/?retryWrites=false", + "valid": true, + "warning": false, + "hosts": null, + "auth": null, + "options": { + "retryWrites": false + } } ] } diff --git a/source/uri-options/tests/connection-options.yml b/source/uri-options/tests/connection-options.yml index 2d312b0861..600b1690ed 100644 --- a/source/uri-options/tests/connection-options.yml +++ b/source/uri-options/tests/connection-options.yml @@ -233,3 +233,74 @@ tests: hosts: ~ auth: ~ options: ~ + - + description: "timeoutMS with large value" + uri: "mongodb://example.com/?timeoutMS=100000" + valid: true + warning: false + hosts: ~ + auth: ~ + options: + timeoutMS: 100000 + - + description: "timeoutMS with SRV URI" + uri: "mongodb+srv://test1.test.build.10gen.cc/?timeoutMS=5000" + valid: true + warning: false + hosts: ~ + auth: ~ + options: + timeoutMS: 5000 + - + description: "Valid appname is parsed correctly" + uri: "mongodb://example.com/?appname=MyApplication" + valid: true + warning: false + hosts: ~ + auth: ~ + options: + appname: "MyApplication" + - + description: "Empty appname is parsed correctly" + uri: "mongodb://example.com/?appname=" + valid: true + warning: false + hosts: ~ + auth: ~ + options: + appname: "" + - + description: "retryReads=true is parsed correctly" + uri: "mongodb://example.com/?retryReads=true" + valid: true + warning: false + hosts: ~ + auth: ~ + options: + retryReads: true + - + description: "retryReads=false is parsed correctly" + uri: "mongodb://example.com/?retryReads=false" + valid: true + warning: false + hosts: ~ + auth: ~ + options: + retryReads: false + - + description: "Invalid retryReads causes a warning" + uri: "mongodb://example.com/?retryReads=invalid" + valid: true + warning: true + hosts: ~ + auth: ~ + options: ~ + - + description: "retryWrites=false is parsed correctly" + uri: "mongodb://example.com/?retryWrites=false" + valid: true + warning: false + hosts: ~ + auth: ~ + options: + retryWrites: false diff --git a/source/uri-options/tests/connection-pool-options.json b/source/uri-options/tests/connection-pool-options.json index a582867d07..c27199032d 100644 --- a/source/uri-options/tests/connection-pool-options.json +++ b/source/uri-options/tests/connection-pool-options.json @@ -71,6 +71,44 @@ "hosts": null, "auth": null, "options": null + }, + { + "description": "waitQueueTimeoutMS with valid value", + "uri": "mongodb://example.com/?waitQueueTimeoutMS=1000", + "valid": true, + "warning": false, + "hosts": null, + "auth": null, + "options": { + "waitQueueTimeoutMS": 1000 + } + }, + { + "description": "waitQueueTimeoutMS with zero value causes a warning", + "uri": "mongodb://example.com/?waitQueueTimeoutMS=0", + "valid": true, + "warning": true, + "hosts": null, + "auth": null, + "options": null + }, + { + "description": "waitQueueTimeoutMS with negative value causes a warning", + "uri": "mongodb://example.com/?waitQueueTimeoutMS=-1", + "valid": true, + "warning": true, + "hosts": null, + "auth": null, + "options": null + }, + { + "description": "waitQueueTimeoutMS with non-integer value causes a warning", + "uri": "mongodb://example.com/?waitQueueTimeoutMS=invalid", + "valid": true, + "warning": true, + "hosts": null, + "auth": null, + "options": null } ] } diff --git a/source/uri-options/tests/connection-pool-options.yml b/source/uri-options/tests/connection-pool-options.yml index bb73093be8..6d56b0123c 100644 --- a/source/uri-options/tests/connection-pool-options.yml +++ b/source/uri-options/tests/connection-pool-options.yml @@ -65,3 +65,36 @@ tests: hosts: ~ auth: ~ options: ~ + - + description: "waitQueueTimeoutMS with valid value" + uri: "mongodb://example.com/?waitQueueTimeoutMS=1000" + valid: true + warning: false + hosts: ~ + auth: ~ + options: + waitQueueTimeoutMS: 1000 + - + description: "waitQueueTimeoutMS with zero value causes a warning" + uri: "mongodb://example.com/?waitQueueTimeoutMS=0" + valid: true + warning: true + hosts: ~ + auth: ~ + options: ~ + - + description: "waitQueueTimeoutMS with negative value causes a warning" + uri: "mongodb://example.com/?waitQueueTimeoutMS=-1" + valid: true + warning: true + hosts: ~ + auth: ~ + options: ~ + - + description: "waitQueueTimeoutMS with non-integer value causes a warning" + uri: "mongodb://example.com/?waitQueueTimeoutMS=invalid" + valid: true + warning: true + hosts: ~ + auth: ~ + options: ~ diff --git a/source/uri-options/tests/read-preference-options.json b/source/uri-options/tests/read-preference-options.json index abbf0d0cc6..c7d87ad395 100644 --- a/source/uri-options/tests/read-preference-options.json +++ b/source/uri-options/tests/read-preference-options.json @@ -77,6 +77,70 @@ "hosts": null, "auth": null, "options": null + }, + { + "description": "readPreference=primary", + "uri": "mongodb://example.com/?readPreference=primary", + "valid": true, + "warning": false, + "hosts": null, + "auth": null, + "options": { + "readPreference": "primary" + } + }, + { + "description": "readPreference=secondary", + "uri": "mongodb://example.com/?readPreference=secondary", + "valid": true, + "warning": false, + "hosts": null, + "auth": null, + "options": { + "readPreference": "secondary" + } + }, + { + "description": "readPreference=secondaryPreferred", + "uri": "mongodb://example.com/?readPreference=secondaryPreferred", + "valid": true, + "warning": false, + "hosts": null, + "auth": null, + "options": { + "readPreference": "secondaryPreferred" + } + }, + { + "description": "readPreference=nearest", + "uri": "mongodb://example.com/?readPreference=nearest", + "valid": true, + "warning": false, + "hosts": null, + "auth": null, + "options": { + "readPreference": "nearest" + } + }, + { + "description": "Invalid readPreference does not cause a warning", + "uri": "mongodb://example.com/?readPreference=invalid", + "valid": true, + "warning": false, + "hosts": null, + "auth": null, + "options": { + "readPreference": "invalid" + } + }, + { + "description": "readPreferenceTags with primary causes a warning", + "uri": "mongodb://example.com/?readPreference=primary&readPreferenceTags=dc:ny", + "valid": true, + "warning": true, + "hosts": null, + "auth": null, + "options": null } ] } diff --git a/source/uri-options/tests/read-preference-options.yml b/source/uri-options/tests/read-preference-options.yml index 267454c0ea..42516642b6 100644 --- a/source/uri-options/tests/read-preference-options.yml +++ b/source/uri-options/tests/read-preference-options.yml @@ -61,4 +61,57 @@ tests: hosts: ~ auth: ~ options: ~ + - + description: "readPreference=primary" + uri: "mongodb://example.com/?readPreference=primary" + valid: true + warning: false + hosts: ~ + auth: ~ + options: + readPreference: "primary" + - + description: "readPreference=secondary" + uri: "mongodb://example.com/?readPreference=secondary" + valid: true + warning: false + hosts: ~ + auth: ~ + options: + readPreference: "secondary" + - + description: "readPreference=secondaryPreferred" + uri: "mongodb://example.com/?readPreference=secondaryPreferred" + valid: true + warning: false + hosts: ~ + auth: ~ + options: + readPreference: "secondaryPreferred" + - + description: "readPreference=nearest" + uri: "mongodb://example.com/?readPreference=nearest" + valid: true + warning: false + hosts: ~ + auth: ~ + options: + readPreference: "nearest" + - + description: "Invalid readPreference does not cause a warning" + uri: "mongodb://example.com/?readPreference=invalid" + valid: true + warning: false + hosts: ~ + auth: ~ + options: + readPreference: "invalid" + - + description: "readPreferenceTags with primary causes a warning" + uri: "mongodb://example.com/?readPreference=primary&readPreferenceTags=dc:ny" + valid: true + warning: true + hosts: ~ + auth: ~ + options: ~ diff --git a/source/uri-options/tests/sdam-options.json b/source/uri-options/tests/sdam-options.json index ae0aeb2821..b2ff046545 100644 --- a/source/uri-options/tests/sdam-options.json +++ b/source/uri-options/tests/sdam-options.json @@ -41,6 +41,68 @@ "hosts": null, "auth": null, "options": null + }, + { + "description": "maxStalenessSeconds with valid value", + "uri": "mongodb://example.com/?maxStalenessSeconds=90", + "valid": true, + "warning": false, + "hosts": null, + "auth": null, + "options": { + "maxStalenessSeconds": 90 + } + }, + { + "description": "maxStalenessSeconds with -1 (no max staleness check)", + "uri": "mongodb://example.com/?maxStalenessSeconds=-1", + "valid": true, + "warning": false, + "hosts": null, + "auth": null, + "options": { + "maxStalenessSeconds": -1 + } + }, + { + "description": "maxStalenessSeconds with value less than minimum (90) causes a warning", + "uri": "mongodb://example.com/?maxStalenessSeconds=89", + "valid": true, + "warning": true, + "hosts": null, + "auth": null, + "options": null + }, + { + "description": "maxStalenessSeconds with non-integer value causes a warning", + "uri": "mongodb://example.com/?maxStalenessSeconds=invalid", + "valid": true, + "warning": true, + "hosts": null, + "auth": null, + "options": null + }, + { + "description": "replicaSet is parsed correctly", + "uri": "mongodb://example.com/?replicaSet=mySet", + "valid": true, + "warning": false, + "hosts": null, + "auth": null, + "options": { + "replicaSet": "mySet" + } + }, + { + "description": "Empty replicaSet is parsed correctly", + "uri": "mongodb://example.com/?replicaSet=", + "valid": true, + "warning": false, + "hosts": null, + "auth": null, + "options": { + "replicaSet": "" + } } ] } diff --git a/source/uri-options/tests/sdam-options.yml b/source/uri-options/tests/sdam-options.yml index 92294b6e52..ff461ebbdd 100644 --- a/source/uri-options/tests/sdam-options.yml +++ b/source/uri-options/tests/sdam-options.yml @@ -33,3 +33,55 @@ tests: hosts: ~ auth: ~ options: ~ + + - description: "maxStalenessSeconds with valid value" + uri: "mongodb://example.com/?maxStalenessSeconds=90" + valid: true + warning: false + hosts: ~ + auth: ~ + options: + maxStalenessSeconds: 90 + + - description: "maxStalenessSeconds with -1 (no max staleness check)" + uri: "mongodb://example.com/?maxStalenessSeconds=-1" + valid: true + warning: false + hosts: ~ + auth: ~ + options: + maxStalenessSeconds: -1 + + - description: "maxStalenessSeconds with value less than minimum (90) causes a warning" + uri: "mongodb://example.com/?maxStalenessSeconds=89" + valid: true + warning: true + hosts: ~ + auth: ~ + options: ~ + + - description: "maxStalenessSeconds with non-integer value causes a warning" + uri: "mongodb://example.com/?maxStalenessSeconds=invalid" + valid: true + warning: true + hosts: ~ + auth: ~ + options: ~ + + - description: "replicaSet is parsed correctly" + uri: "mongodb://example.com/?replicaSet=mySet" + valid: true + warning: false + hosts: ~ + auth: ~ + options: + replicaSet: "mySet" + + - description: "Empty replicaSet is parsed correctly" + uri: "mongodb://example.com/?replicaSet=" + valid: true + warning: false + hosts: ~ + auth: ~ + options: + replicaSet: ""