diff --git a/test/integration/client-side-operations-timeout/unified-csot-node-specs/command-execution.json b/test/integration/client-side-operations-timeout/unified-csot-node-specs/command-execution.json index 019b238f7f1..8cf75b84790 100644 --- a/test/integration/client-side-operations-timeout/unified-csot-node-specs/command-execution.json +++ b/test/integration/client-side-operations-timeout/unified-csot-node-specs/command-execution.json @@ -1,6 +1,6 @@ { "description": "timeoutMS behaves correctly during command execution", - "schemaVersion": "1.9", + "schemaVersion": "1.26", "runOnRequirements": [ { "minServerVersion": "4.4.7", @@ -68,8 +68,10 @@ "appName": "reduceMaxTimeMSTest", "w": 1, "timeoutMS": 500, - "heartbeatFrequencyMS": 500 + "heartbeatFrequencyMS": 500, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "observeEvents": [ "commandStartedEvent" ] diff --git a/test/spec/client-side-operations-timeout/command-execution.json b/test/spec/client-side-operations-timeout/command-execution.json index aa9c3eb23f3..212cd41089d 100644 --- a/test/spec/client-side-operations-timeout/command-execution.json +++ b/test/spec/client-side-operations-timeout/command-execution.json @@ -1,6 +1,6 @@ { "description": "timeoutMS behaves correctly during command execution", - "schemaVersion": "1.9", + "schemaVersion": "1.26", "runOnRequirements": [ { "minServerVersion": "4.4.7", @@ -69,8 +69,10 @@ "appName": "reduceMaxTimeMSTest", "w": 1, "timeoutMS": 500, - "heartbeatFrequencyMS": 500 + "heartbeatFrequencyMS": 500, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "observeEvents": [ "commandStartedEvent" ] @@ -185,8 +187,10 @@ "appName": "rttTooHighTest", "w": 1, "timeoutMS": 10, - "heartbeatFrequencyMS": 500 + "heartbeatFrequencyMS": 500, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "observeEvents": [ "commandStartedEvent" ] @@ -316,8 +320,10 @@ "appName": "reduceMaxTimeMSTest", "w": 1, "timeoutMS": 90, - "heartbeatFrequencyMS": 100000 + "heartbeatFrequencyMS": 100000, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "observeEvents": [ "commandStartedEvent" ] diff --git a/test/spec/client-side-operations-timeout/command-execution.yml b/test/spec/client-side-operations-timeout/command-execution.yml index 6ba0585b3ca..95a9abeefc7 100644 --- a/test/spec/client-side-operations-timeout/command-execution.yml +++ b/test/spec/client-side-operations-timeout/command-execution.yml @@ -1,6 +1,6 @@ description: "timeoutMS behaves correctly during command execution" -schemaVersion: "1.9" +schemaVersion: "1.26" runOnRequirements: # Require SERVER-49336 for failCommand + appName on the initial handshake. @@ -56,6 +56,8 @@ tests: w: 1 # Override server's w:majority default to speed up the test. timeoutMS: 500 heartbeatFrequencyMS: 500 + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 observeEvents: - commandStartedEvent - database: @@ -127,6 +129,8 @@ tests: w: 1 # Override server's w:majority default to speed up the test. timeoutMS: 10 heartbeatFrequencyMS: 500 + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 observeEvents: - commandStartedEvent - database: @@ -210,6 +214,8 @@ tests: w: 1 # Override server's w:majority default to speed up the test. timeoutMS: 90 heartbeatFrequencyMS: 100000 # Override heartbeatFrequencyMS to ensure only 1 RTT is recorded. + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 observeEvents: - commandStartedEvent - database: diff --git a/test/spec/client-side-operations-timeout/convenient-transactions.json b/test/spec/client-side-operations-timeout/convenient-transactions.json index 3868b3026c2..f9d03429db9 100644 --- a/test/spec/client-side-operations-timeout/convenient-transactions.json +++ b/test/spec/client-side-operations-timeout/convenient-transactions.json @@ -1,6 +1,6 @@ { "description": "timeoutMS behaves correctly for the withTransaction API", - "schemaVersion": "1.9", + "schemaVersion": "1.26", "runOnRequirements": [ { "minServerVersion": "4.4", @@ -21,8 +21,10 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 500 + "timeoutMS": 500, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "useMultipleMongoses": false, "observeEvents": [ "commandStartedEvent" diff --git a/test/spec/client-side-operations-timeout/convenient-transactions.yml b/test/spec/client-side-operations-timeout/convenient-transactions.yml index 02d48b83242..55b72481dfb 100644 --- a/test/spec/client-side-operations-timeout/convenient-transactions.yml +++ b/test/spec/client-side-operations-timeout/convenient-transactions.yml @@ -1,6 +1,6 @@ description: "timeoutMS behaves correctly for the withTransaction API" -schemaVersion: "1.9" +schemaVersion: "1.26" runOnRequirements: - minServerVersion: "4.4" @@ -14,6 +14,8 @@ createEntities: id: &client client uriOptions: timeoutMS: 500 + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 useMultipleMongoses: false observeEvents: - commandStartedEvent diff --git a/test/spec/client-side-operations-timeout/error-transformations.json b/test/spec/client-side-operations-timeout/error-transformations.json index 4889e39583a..89be49f0a4f 100644 --- a/test/spec/client-side-operations-timeout/error-transformations.json +++ b/test/spec/client-side-operations-timeout/error-transformations.json @@ -1,6 +1,6 @@ { "description": "MaxTimeMSExpired server errors are transformed into a custom timeout error", - "schemaVersion": "1.9", + "schemaVersion": "1.26", "runOnRequirements": [ { "minServerVersion": "4.0", @@ -26,8 +26,10 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 250 + "timeoutMS": 250, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "useMultipleMongoses": false, "observeEvents": [ "commandStartedEvent" diff --git a/test/spec/client-side-operations-timeout/error-transformations.yml b/test/spec/client-side-operations-timeout/error-transformations.yml index 7bff4776a83..0ea9373b7dd 100644 --- a/test/spec/client-side-operations-timeout/error-transformations.yml +++ b/test/spec/client-side-operations-timeout/error-transformations.yml @@ -1,6 +1,6 @@ description: "MaxTimeMSExpired server errors are transformed into a custom timeout error" -schemaVersion: "1.9" +schemaVersion: "1.26" # failCommand is available on 4.0 for replica sets and 4.2 for sharded clusters. runOnRequirements: @@ -17,6 +17,8 @@ createEntities: id: &client client uriOptions: timeoutMS: 250 + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 useMultipleMongoses: false observeEvents: - commandStartedEvent diff --git a/test/spec/client-side-operations-timeout/global-timeoutMS.json b/test/spec/client-side-operations-timeout/global-timeoutMS.json index f1edbe68e39..9d8046d1bfa 100644 --- a/test/spec/client-side-operations-timeout/global-timeoutMS.json +++ b/test/spec/client-side-operations-timeout/global-timeoutMS.json @@ -1,6 +1,6 @@ { "description": "timeoutMS can be configured on a MongoClient", - "schemaVersion": "1.9", + "schemaVersion": "1.26", "runOnRequirements": [ { "minServerVersion": "4.4", @@ -38,8 +38,10 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 250 + "timeoutMS": 250, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "useMultipleMongoses": false, "observeEvents": [ "commandStartedEvent" @@ -217,8 +219,10 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 250 + "timeoutMS": 250, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "useMultipleMongoses": false, "observeEvents": [ "commandStartedEvent" @@ -390,8 +394,10 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 250 + "timeoutMS": 250, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "useMultipleMongoses": false, "observeEvents": [ "commandStartedEvent" @@ -569,8 +575,10 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 250 + "timeoutMS": 250, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "useMultipleMongoses": false, "observeEvents": [ "commandStartedEvent" @@ -762,8 +770,10 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 250 + "timeoutMS": 250, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "useMultipleMongoses": false, "observeEvents": [ "commandStartedEvent" @@ -941,8 +951,10 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 250 + "timeoutMS": 250, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "useMultipleMongoses": false, "observeEvents": [ "commandStartedEvent" @@ -1120,8 +1132,10 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 250 + "timeoutMS": 250, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "useMultipleMongoses": false, "observeEvents": [ "commandStartedEvent" @@ -1305,8 +1319,10 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 250 + "timeoutMS": 250, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "useMultipleMongoses": false, "observeEvents": [ "commandStartedEvent" @@ -1484,8 +1500,10 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 250 + "timeoutMS": 250, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "useMultipleMongoses": false, "observeEvents": [ "commandStartedEvent" @@ -1663,8 +1681,10 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 250 + "timeoutMS": 250, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "useMultipleMongoses": false, "observeEvents": [ "commandStartedEvent" @@ -1842,8 +1862,10 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 250 + "timeoutMS": 250, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "useMultipleMongoses": false, "observeEvents": [ "commandStartedEvent" @@ -2021,8 +2043,10 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 250 + "timeoutMS": 250, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "useMultipleMongoses": false, "observeEvents": [ "commandStartedEvent" @@ -2194,8 +2218,10 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 250 + "timeoutMS": 250, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "useMultipleMongoses": false, "observeEvents": [ "commandStartedEvent" @@ -2375,8 +2401,10 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 250 + "timeoutMS": 250, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "useMultipleMongoses": false, "observeEvents": [ "commandStartedEvent" @@ -2554,8 +2582,10 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 250 + "timeoutMS": 250, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "useMultipleMongoses": false, "observeEvents": [ "commandStartedEvent" @@ -2733,8 +2763,10 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 250 + "timeoutMS": 250, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "useMultipleMongoses": false, "observeEvents": [ "commandStartedEvent" @@ -2906,8 +2938,10 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 250 + "timeoutMS": 250, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "useMultipleMongoses": false, "observeEvents": [ "commandStartedEvent" @@ -3079,8 +3113,10 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 250 + "timeoutMS": 250, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "useMultipleMongoses": false, "observeEvents": [ "commandStartedEvent" @@ -3258,8 +3294,10 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 250 + "timeoutMS": 250, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "useMultipleMongoses": false, "observeEvents": [ "commandStartedEvent" @@ -3441,8 +3479,10 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 250 + "timeoutMS": 250, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "useMultipleMongoses": false, "observeEvents": [ "commandStartedEvent" @@ -3628,8 +3668,10 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 250 + "timeoutMS": 250, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "useMultipleMongoses": false, "observeEvents": [ "commandStartedEvent" @@ -3807,8 +3849,10 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 250 + "timeoutMS": 250, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "useMultipleMongoses": false, "observeEvents": [ "commandStartedEvent" @@ -3986,8 +4030,10 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 250 + "timeoutMS": 250, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "useMultipleMongoses": false, "observeEvents": [ "commandStartedEvent" @@ -4171,8 +4217,10 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 250 + "timeoutMS": 250, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "useMultipleMongoses": false, "observeEvents": [ "commandStartedEvent" @@ -4360,8 +4408,10 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 250 + "timeoutMS": 250, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "useMultipleMongoses": false, "observeEvents": [ "commandStartedEvent" @@ -4549,8 +4599,10 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 250 + "timeoutMS": 250, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "useMultipleMongoses": false, "observeEvents": [ "commandStartedEvent" @@ -4728,8 +4780,10 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 250 + "timeoutMS": 250, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "useMultipleMongoses": false, "observeEvents": [ "commandStartedEvent" @@ -4913,8 +4967,10 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 250 + "timeoutMS": 250, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "useMultipleMongoses": false, "observeEvents": [ "commandStartedEvent" @@ -5102,8 +5158,10 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 250 + "timeoutMS": 250, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "useMultipleMongoses": false, "observeEvents": [ "commandStartedEvent" @@ -5297,8 +5355,10 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 250 + "timeoutMS": 250, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "useMultipleMongoses": false, "observeEvents": [ "commandStartedEvent" @@ -5482,8 +5542,10 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 250 + "timeoutMS": 250, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "useMultipleMongoses": false, "observeEvents": [ "commandStartedEvent" @@ -5677,8 +5739,10 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 250 + "timeoutMS": 250, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "useMultipleMongoses": false, "observeEvents": [ "commandStartedEvent" diff --git a/test/spec/client-side-operations-timeout/global-timeoutMS.yml b/test/spec/client-side-operations-timeout/global-timeoutMS.yml index 847c26f096b..8cb1013166a 100644 --- a/test/spec/client-side-operations-timeout/global-timeoutMS.yml +++ b/test/spec/client-side-operations-timeout/global-timeoutMS.yml @@ -2,7 +2,7 @@ description: "timeoutMS can be configured on a MongoClient" -schemaVersion: "1.9" +schemaVersion: "1.26" runOnRequirements: - minServerVersion: "4.4" @@ -39,6 +39,8 @@ tests: id: &client client uriOptions: timeoutMS: 250 + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 useMultipleMongoses: false observeEvents: - commandStartedEvent @@ -139,6 +141,8 @@ tests: id: &client client uriOptions: timeoutMS: 250 + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 useMultipleMongoses: false observeEvents: - commandStartedEvent @@ -235,6 +239,8 @@ tests: id: &client client uriOptions: timeoutMS: 250 + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 useMultipleMongoses: false observeEvents: - commandStartedEvent @@ -335,6 +341,8 @@ tests: id: &client client uriOptions: timeoutMS: 250 + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 useMultipleMongoses: false observeEvents: - commandStartedEvent @@ -435,6 +443,8 @@ tests: id: &client client uriOptions: timeoutMS: 250 + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 useMultipleMongoses: false observeEvents: - commandStartedEvent @@ -535,6 +545,8 @@ tests: id: &client client uriOptions: timeoutMS: 250 + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 useMultipleMongoses: false observeEvents: - commandStartedEvent @@ -635,6 +647,8 @@ tests: id: &client client uriOptions: timeoutMS: 250 + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 useMultipleMongoses: false observeEvents: - commandStartedEvent @@ -737,6 +751,8 @@ tests: id: &client client uriOptions: timeoutMS: 250 + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 useMultipleMongoses: false observeEvents: - commandStartedEvent @@ -837,6 +853,8 @@ tests: id: &client client uriOptions: timeoutMS: 250 + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 useMultipleMongoses: false observeEvents: - commandStartedEvent @@ -937,6 +955,8 @@ tests: id: &client client uriOptions: timeoutMS: 250 + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 useMultipleMongoses: false observeEvents: - commandStartedEvent @@ -1037,6 +1057,8 @@ tests: id: &client client uriOptions: timeoutMS: 250 + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 useMultipleMongoses: false observeEvents: - commandStartedEvent @@ -1137,6 +1159,8 @@ tests: id: &client client uriOptions: timeoutMS: 250 + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 useMultipleMongoses: false observeEvents: - commandStartedEvent @@ -1233,6 +1257,8 @@ tests: id: &client client uriOptions: timeoutMS: 250 + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 useMultipleMongoses: false observeEvents: - commandStartedEvent @@ -1335,6 +1361,8 @@ tests: id: &client client uriOptions: timeoutMS: 250 + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 useMultipleMongoses: false observeEvents: - commandStartedEvent @@ -1435,6 +1463,8 @@ tests: id: &client client uriOptions: timeoutMS: 250 + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 useMultipleMongoses: false observeEvents: - commandStartedEvent @@ -1535,6 +1565,8 @@ tests: id: &client client uriOptions: timeoutMS: 250 + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 useMultipleMongoses: false observeEvents: - commandStartedEvent @@ -1631,6 +1663,8 @@ tests: id: &client client uriOptions: timeoutMS: 250 + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 useMultipleMongoses: false observeEvents: - commandStartedEvent @@ -1727,6 +1761,8 @@ tests: id: &client client uriOptions: timeoutMS: 250 + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 useMultipleMongoses: false observeEvents: - commandStartedEvent @@ -1827,6 +1863,8 @@ tests: id: &client client uriOptions: timeoutMS: 250 + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 useMultipleMongoses: false observeEvents: - commandStartedEvent @@ -1927,6 +1965,8 @@ tests: id: &client client uriOptions: timeoutMS: 250 + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 useMultipleMongoses: false observeEvents: - commandStartedEvent @@ -2029,6 +2069,8 @@ tests: id: &client client uriOptions: timeoutMS: 250 + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 useMultipleMongoses: false observeEvents: - commandStartedEvent @@ -2129,6 +2171,8 @@ tests: id: &client client uriOptions: timeoutMS: 250 + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 useMultipleMongoses: false observeEvents: - commandStartedEvent @@ -2229,6 +2273,8 @@ tests: id: &client client uriOptions: timeoutMS: 250 + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 useMultipleMongoses: false observeEvents: - commandStartedEvent @@ -2331,6 +2377,8 @@ tests: id: &client client uriOptions: timeoutMS: 250 + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 useMultipleMongoses: false observeEvents: - commandStartedEvent @@ -2433,6 +2481,8 @@ tests: id: &client client uriOptions: timeoutMS: 250 + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 useMultipleMongoses: false observeEvents: - commandStartedEvent @@ -2535,6 +2585,8 @@ tests: id: &client client uriOptions: timeoutMS: 250 + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 useMultipleMongoses: false observeEvents: - commandStartedEvent @@ -2635,6 +2687,8 @@ tests: id: &client client uriOptions: timeoutMS: 250 + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 useMultipleMongoses: false observeEvents: - commandStartedEvent @@ -2737,6 +2791,8 @@ tests: id: &client client uriOptions: timeoutMS: 250 + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 useMultipleMongoses: false observeEvents: - commandStartedEvent @@ -2839,6 +2895,8 @@ tests: id: &client client uriOptions: timeoutMS: 250 + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 useMultipleMongoses: false observeEvents: - commandStartedEvent @@ -2943,6 +3001,8 @@ tests: id: &client client uriOptions: timeoutMS: 250 + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 useMultipleMongoses: false observeEvents: - commandStartedEvent @@ -3045,6 +3105,8 @@ tests: id: &client client uriOptions: timeoutMS: 250 + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 useMultipleMongoses: false observeEvents: - commandStartedEvent @@ -3154,6 +3216,8 @@ tests: id: &client client uriOptions: timeoutMS: 250 + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 useMultipleMongoses: false observeEvents: - commandStartedEvent diff --git a/test/spec/client-side-operations-timeout/non-tailable-cursors.json b/test/spec/client-side-operations-timeout/non-tailable-cursors.json index 291c6e72aa1..58c59cb32d3 100644 --- a/test/spec/client-side-operations-timeout/non-tailable-cursors.json +++ b/test/spec/client-side-operations-timeout/non-tailable-cursors.json @@ -1,6 +1,6 @@ { "description": "timeoutMS behaves correctly for non-tailable cursors", - "schemaVersion": "1.9", + "schemaVersion": "1.26", "runOnRequirements": [ { "minServerVersion": "4.4" @@ -17,8 +17,10 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 200 + "timeoutMS": 200, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "useMultipleMongoses": false, "observeEvents": [ "commandStartedEvent" diff --git a/test/spec/client-side-operations-timeout/non-tailable-cursors.yml b/test/spec/client-side-operations-timeout/non-tailable-cursors.yml index 29037b4c0a3..c0d34c96b94 100644 --- a/test/spec/client-side-operations-timeout/non-tailable-cursors.yml +++ b/test/spec/client-side-operations-timeout/non-tailable-cursors.yml @@ -1,6 +1,6 @@ description: "timeoutMS behaves correctly for non-tailable cursors" -schemaVersion: "1.9" +schemaVersion: "1.26" runOnRequirements: - minServerVersion: "4.4" @@ -13,6 +13,8 @@ createEntities: id: &client client uriOptions: timeoutMS: 200 + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 useMultipleMongoses: false observeEvents: - commandStartedEvent diff --git a/test/spec/client-side-operations-timeout/retryability-timeoutMS.json b/test/spec/client-side-operations-timeout/retryability-timeoutMS.json index 9daad260ef3..5a0c9f36051 100644 --- a/test/spec/client-side-operations-timeout/retryability-timeoutMS.json +++ b/test/spec/client-side-operations-timeout/retryability-timeoutMS.json @@ -1,6 +1,6 @@ { "description": "timeoutMS behaves correctly for retryable operations", - "schemaVersion": "1.9", + "schemaVersion": "1.26", "runOnRequirements": [ { "minServerVersion": "4.0", @@ -26,8 +26,10 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 100 + "timeoutMS": 100, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "useMultipleMongoses": false, "observeEvents": [ "commandStartedEvent" diff --git a/test/spec/client-side-operations-timeout/retryability-timeoutMS.yml b/test/spec/client-side-operations-timeout/retryability-timeoutMS.yml index 6f47d6c2e42..5e0ad164a2c 100644 --- a/test/spec/client-side-operations-timeout/retryability-timeoutMS.yml +++ b/test/spec/client-side-operations-timeout/retryability-timeoutMS.yml @@ -2,7 +2,7 @@ description: "timeoutMS behaves correctly for retryable operations" -schemaVersion: "1.9" +schemaVersion: "1.26" # failCommand is available on 4.0+ replica sets and 4.2+ sharded clusters. runOnRequirements: @@ -19,6 +19,8 @@ createEntities: id: &client client uriOptions: timeoutMS: 100 + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 useMultipleMongoses: false observeEvents: - commandStartedEvent diff --git a/test/spec/client-side-operations-timeout/runCursorCommand.json b/test/spec/client-side-operations-timeout/runCursorCommand.json index 36f774fb5af..e5182e338e7 100644 --- a/test/spec/client-side-operations-timeout/runCursorCommand.json +++ b/test/spec/client-side-operations-timeout/runCursorCommand.json @@ -1,6 +1,6 @@ { "description": "runCursorCommand", - "schemaVersion": "1.9", + "schemaVersion": "1.26", "runOnRequirements": [ { "minServerVersion": "4.4" @@ -16,6 +16,10 @@ { "client": { "id": "commandClient", + "uriOptions": { + "minPoolSize": 1 + }, + "awaitMinPoolSizeMS": 10000, "useMultipleMongoses": false, "observeEvents": [ "commandStartedEvent", diff --git a/test/spec/client-side-operations-timeout/runCursorCommand.yml b/test/spec/client-side-operations-timeout/runCursorCommand.yml index 91a18d6dd81..e0b7cfe6d24 100644 --- a/test/spec/client-side-operations-timeout/runCursorCommand.yml +++ b/test/spec/client-side-operations-timeout/runCursorCommand.yml @@ -1,6 +1,6 @@ description: runCursorCommand -schemaVersion: '1.9' +schemaVersion: '1.26' runOnRequirements: - minServerVersion: "4.4" @@ -11,6 +11,9 @@ createEntities: useMultipleMongoses: false - client: id: &commandClient commandClient + uriOptions: + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 useMultipleMongoses: false observeEvents: [commandStartedEvent, commandSucceededEvent] - client: diff --git a/test/spec/client-side-operations-timeout/sessions-inherit-timeoutMS.json b/test/spec/client-side-operations-timeout/sessions-inherit-timeoutMS.json index 13ea91c7948..dbf163e484e 100644 --- a/test/spec/client-side-operations-timeout/sessions-inherit-timeoutMS.json +++ b/test/spec/client-side-operations-timeout/sessions-inherit-timeoutMS.json @@ -1,6 +1,6 @@ { "description": "sessions inherit timeoutMS from their parent MongoClient", - "schemaVersion": "1.9", + "schemaVersion": "1.26", "runOnRequirements": [ { "minServerVersion": "4.4", @@ -21,8 +21,10 @@ "client": { "id": "client", "uriOptions": { - "timeoutMS": 500 + "timeoutMS": 500, + "minPoolSize": 1 }, + "awaitMinPoolSizeMS": 10000, "useMultipleMongoses": false, "observeEvents": [ "commandStartedEvent", diff --git a/test/spec/client-side-operations-timeout/sessions-inherit-timeoutMS.yml b/test/spec/client-side-operations-timeout/sessions-inherit-timeoutMS.yml index c79384e5f0b..77f216d3adf 100644 --- a/test/spec/client-side-operations-timeout/sessions-inherit-timeoutMS.yml +++ b/test/spec/client-side-operations-timeout/sessions-inherit-timeoutMS.yml @@ -1,6 +1,6 @@ description: "sessions inherit timeoutMS from their parent MongoClient" -schemaVersion: "1.9" +schemaVersion: "1.26" runOnRequirements: - minServerVersion: "4.4" @@ -14,6 +14,8 @@ createEntities: id: &client client uriOptions: timeoutMS: 500 + minPoolSize: 1 + awaitMinPoolSizeMS: 10000 useMultipleMongoses: false observeEvents: - commandStartedEvent diff --git a/test/tools/unified-spec-runner/entities.ts b/test/tools/unified-spec-runner/entities.ts index 34d5aa886d9..148222cc165 100644 --- a/test/tools/unified-spec-runner/entities.ts +++ b/test/tools/unified-spec-runner/entities.ts @@ -1,5 +1,6 @@ import { AssertionError, expect } from 'chai'; import { EventEmitter } from 'events'; +import { setImmediate } from 'timers'; import { AbstractCursor, @@ -17,6 +18,7 @@ import { type ConnectionCheckOutStartedEvent, type ConnectionClosedEvent, type ConnectionCreatedEvent, + type ConnectionPool, type ConnectionPoolClearedEvent, type ConnectionPoolClosedEvent, type ConnectionPoolCreatedEvent, @@ -39,6 +41,8 @@ import { type ServerHeartbeatStartedEvent, type ServerHeartbeatSucceededEvent, type ServerOpeningEvent, + Timeout, + TimeoutError, type TopologyClosedEvent, type TopologyDescription, type TopologyDescriptionChangedEvent, @@ -622,6 +626,26 @@ export class EntitiesMap extends Map { try { new EntityEventRegistry(client, entity.client, map).register(); await client.connect(); + if (entity.client.awaitMinPoolSizeMS) { + if (client.topology?.s?.servers) { + const timeout = Timeout.expires(entity.client.awaitMinPoolSizeMS); + const poolSizeChecks = client.topology.s.servers + .values() + .map(server => checkMinPoolSize(server.pool)); + try { + await Promise.race([Promise.allSettled(poolSizeChecks), timeout]); + } catch (error) { + if (TimeoutError.is(error)) { + throw new AssertionError( + `Timed out waiting for min pool size to be populated within ${entity.client.awaitMinPoolSizeMS}ms` + ); + } + throw error; + } finally { + timeout.clear(); + } + } + } } catch (error) { console.error('failed to connect entity', entity); // In the case where multiple clients are defined in the test and any one of them failed @@ -721,3 +745,16 @@ export class EntitiesMap extends Map { return map; } } + +function checkMinPoolSize(pool: ConnectionPool): Promise { + return new Promise(resolve => { + const checkSize = () => { + if (pool.totalConnectionCount >= pool.options.minPoolSize) { + resolve(true); + } else { + setImmediate(checkSize); + } + }; + checkSize(); + }); +} diff --git a/test/tools/unified-spec-runner/schema.ts b/test/tools/unified-spec-runner/schema.ts index 8ec850979fa..0f7e048b17b 100644 --- a/test/tools/unified-spec-runner/schema.ts +++ b/test/tools/unified-spec-runner/schema.ts @@ -155,6 +155,7 @@ export interface ClientEntity { ignoreCommandMonitoringEvents?: string[]; serverApi?: ServerApi; observeSensitiveCommands?: boolean; + awaitMinPoolSizeMS?: number; // Was optionally scheduled for removal in NODE-6783, but opted to keep it for potential future use. storeEventsAsEntities?: StoreEventsAsEntity[]; autoEncryptOpts?: Pick<