From 33fed1136f583bf212ea0f66a3d95a7fe8011931 Mon Sep 17 00:00:00 2001 From: Neal Beeken Date: Mon, 4 Nov 2024 11:33:04 -0500 Subject: [PATCH 1/5] test(NODE-6493): sync runCursorCommand fixes --- .../client_side_operations_timeout.spec.test.ts | 5 ----- .../runCursorCommand.json | 4 ++-- .../runCursorCommand.yml | 11 ++++++----- test/tools/unified-spec-runner/operations.ts | 12 ++++++++++-- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/test/integration/client-side-operations-timeout/client_side_operations_timeout.spec.test.ts b/test/integration/client-side-operations-timeout/client_side_operations_timeout.spec.test.ts index be8bc5e340a..a4ada025d20 100644 --- a/test/integration/client-side-operations-timeout/client_side_operations_timeout.spec.test.ts +++ b/test/integration/client-side-operations-timeout/client_side_operations_timeout.spec.test.ts @@ -7,12 +7,7 @@ import { runUnifiedSuite } from '../../tools/unified-spec-runner/runner'; const skippedSpecs = {}; const skippedTests = { - 'Tailable cursor iteration timeoutMS is refreshed for getMore - failure': 'TODO(NODE-6493)', - 'Tailable cursor awaitData iteration timeoutMS is refreshed for getMore - failure': - 'TODO(NODE-6493)', 'command is not sent if RTT is greater than timeoutMS': 'TODO(DRIVERS-2965)', - 'Non=tailable cursor iteration timeoutMS is refreshed for getMore if timeoutMode is iteration - failure': - 'TODO(DRIVERS-2965)', 'Non-tailable cursor lifetime remaining timeoutMS applied to getMore if timeoutMode is unset': 'TODO(DRIVERS-2965)', 'maxTimeMS value in the command is less than timeoutMS': diff --git a/test/spec/client-side-operations-timeout/runCursorCommand.json b/test/spec/client-side-operations-timeout/runCursorCommand.json index 5fc0be33997..36f774fb5af 100644 --- a/test/spec/client-side-operations-timeout/runCursorCommand.json +++ b/test/spec/client-side-operations-timeout/runCursorCommand.json @@ -200,7 +200,7 @@ }, "collection": "collection", "maxTimeMS": { - "$$exists": true + "$$exists": false } } } @@ -210,7 +210,7 @@ ] }, { - "description": "Non=tailable cursor iteration timeoutMS is refreshed for getMore if timeoutMode is iteration - failure", + "description": "Non-tailable cursor iteration timeoutMS is refreshed for getMore if timeoutMode is iteration - failure", "runOnRequirements": [ { "serverless": "forbid" diff --git a/test/spec/client-side-operations-timeout/runCursorCommand.yml b/test/spec/client-side-operations-timeout/runCursorCommand.yml index 16a648e0280..91a18d6dd81 100644 --- a/test/spec/client-side-operations-timeout/runCursorCommand.yml +++ b/test/spec/client-side-operations-timeout/runCursorCommand.yml @@ -70,7 +70,7 @@ tests: runOnRequirements: - serverless: forbid operations: - # Block find/getMore for 15ms. + # Block find/getMore for 60ms. - name: failPoint object: testRunner arguments: @@ -83,8 +83,9 @@ tests: blockConnection: true blockTimeMS: 60 # Run a find with timeoutMS less than double our failPoint blockTimeMS and - # batchSize less than the total document count will cause a find and a getMore to be sent. - # Both will block for 60ms so together they will go over the timeout. + # batchSize less than the total document count will cause a find and a + # getMore to be sent. Both will block for 60ms so together they will go + # over the timeout. - name: runCursorCommand object: *db arguments: @@ -106,12 +107,12 @@ tests: command: getMore: { $$type: [int, long] } collection: *collection - maxTimeMS: { $$exists: true } + maxTimeMS: { $$exists: false } # If timeoutMode=ITERATION, timeoutMS applies separately to the initial find and the getMore on the cursor. Neither # command should have a maxTimeMS field. This is a failure test. The "find" inherits timeoutMS=100 and "getMore" # commands are blocked for 60ms, causing iteration to fail with a timeout error. - - description: Non=tailable cursor iteration timeoutMS is refreshed for getMore if timeoutMode is iteration - failure + - description: Non-tailable cursor iteration timeoutMS is refreshed for getMore if timeoutMode is iteration - failure runOnRequirements: - serverless: forbid operations: diff --git a/test/tools/unified-spec-runner/operations.ts b/test/tools/unified-spec-runner/operations.ts index f7c34a70239..a4df32d7d40 100644 --- a/test/tools/unified-spec-runner/operations.ts +++ b/test/tools/unified-spec-runner/operations.ts @@ -821,7 +821,9 @@ operations.set('runCursorCommand', async ({ entities, operation }: OperationFunc if (!Number.isNaN(+opts.maxTimeMS)) cursor.setMaxTimeMS(+opts.maxTimeMS); if (opts.comment !== undefined) cursor.setComment(opts.comment); - return cursor.toArray(); + const result = await cursor.toArray().catch(err => err); + if (result instanceof Error) throw result; + return result; }); operations.set('createCommandCursor', async ({ entities, operation }: OperationFunctionParams) => { @@ -1045,7 +1047,13 @@ export async function executeOperationAndCheck( } if (operation.expectError) { - expect.fail(`Operation ${operation.name} succeeded but was not supposed to`); + const events = Array.from(entities.mapOf('client').entries(), ([_, client]) => + client + .getCapturedEvents('command') + .map(event => `${event.name}(${event.commandName})`) + .join(', ') + ).join(', '); + expect.fail(`Operation ${operation.name} succeeded but was not supposed to: ${events}`); } if (operation.expectResult) { From 853a8f4b641407bfd8b0f4646d2776775095bc43 Mon Sep 17 00:00:00 2001 From: Neal Beeken Date: Mon, 4 Nov 2024 15:27:47 -0500 Subject: [PATCH 2/5] chore: sync-ed test that was changed --- .../client_side_operations_timeout.spec.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/client-side-operations-timeout/client_side_operations_timeout.spec.test.ts b/test/integration/client-side-operations-timeout/client_side_operations_timeout.spec.test.ts index a4ada025d20..d1f2ad69c0e 100644 --- a/test/integration/client-side-operations-timeout/client_side_operations_timeout.spec.test.ts +++ b/test/integration/client-side-operations-timeout/client_side_operations_timeout.spec.test.ts @@ -8,7 +8,7 @@ const skippedSpecs = {}; const skippedTests = { 'command is not sent if RTT is greater than timeoutMS': 'TODO(DRIVERS-2965)', - 'Non-tailable cursor lifetime remaining timeoutMS applied to getMore if timeoutMode is unset': + 'Non-tailable cursor iteration timeoutMS is refreshed for getMore if timeoutMode is iteration - failure': 'TODO(DRIVERS-2965)', 'maxTimeMS value in the command is less than timeoutMS': 'TODO(DRIVERS-2970): see modified test in unified-csot-node-specs', From c6ae429b9b932ccc71bbe44c7df3a26effe61343 Mon Sep 17 00:00:00 2001 From: Neal Beeken Date: Mon, 4 Nov 2024 15:28:23 -0500 Subject: [PATCH 3/5] chore: reset operations --- test/tools/unified-spec-runner/operations.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/test/tools/unified-spec-runner/operations.ts b/test/tools/unified-spec-runner/operations.ts index a4df32d7d40..f7c34a70239 100644 --- a/test/tools/unified-spec-runner/operations.ts +++ b/test/tools/unified-spec-runner/operations.ts @@ -821,9 +821,7 @@ operations.set('runCursorCommand', async ({ entities, operation }: OperationFunc if (!Number.isNaN(+opts.maxTimeMS)) cursor.setMaxTimeMS(+opts.maxTimeMS); if (opts.comment !== undefined) cursor.setComment(opts.comment); - const result = await cursor.toArray().catch(err => err); - if (result instanceof Error) throw result; - return result; + return cursor.toArray(); }); operations.set('createCommandCursor', async ({ entities, operation }: OperationFunctionParams) => { @@ -1047,13 +1045,7 @@ export async function executeOperationAndCheck( } if (operation.expectError) { - const events = Array.from(entities.mapOf('client').entries(), ([_, client]) => - client - .getCapturedEvents('command') - .map(event => `${event.name}(${event.commandName})`) - .join(', ') - ).join(', '); - expect.fail(`Operation ${operation.name} succeeded but was not supposed to: ${events}`); + expect.fail(`Operation ${operation.name} succeeded but was not supposed to`); } if (operation.expectResult) { From e7f2d07faf733964ac96361eea70f17a1448795a Mon Sep 17 00:00:00 2001 From: Neal Beeken Date: Mon, 4 Nov 2024 15:33:44 -0500 Subject: [PATCH 4/5] chore --- .../client_side_operations_timeout.spec.test.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/integration/client-side-operations-timeout/client_side_operations_timeout.spec.test.ts b/test/integration/client-side-operations-timeout/client_side_operations_timeout.spec.test.ts index d1f2ad69c0e..ed8e2e801bd 100644 --- a/test/integration/client-side-operations-timeout/client_side_operations_timeout.spec.test.ts +++ b/test/integration/client-side-operations-timeout/client_side_operations_timeout.spec.test.ts @@ -10,6 +10,8 @@ const skippedTests = { 'command is not sent if RTT is greater than timeoutMS': 'TODO(DRIVERS-2965)', 'Non-tailable cursor iteration timeoutMS is refreshed for getMore if timeoutMode is iteration - failure': 'TODO(DRIVERS-2965)', + 'Non-tailable cursor lifetime remaining timeoutMS applied to getMore if timeoutMode is unset': + 'TODO(DRIVERS-2965)', 'maxTimeMS value in the command is less than timeoutMS': 'TODO(DRIVERS-2970): see modified test in unified-csot-node-specs', 'timeoutMS is refreshed for getMore - failure': From 396b19ca85885285c23d7468d3277884ad29711f Mon Sep 17 00:00:00 2001 From: Neal Beeken Date: Mon, 4 Nov 2024 15:38:52 -0500 Subject: [PATCH 5/5] chore: unskip Non-tailable cursor lifetime remaining timeoutMS applied to getMore if timeoutMode is unset --- .../client_side_operations_timeout.spec.test.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/integration/client-side-operations-timeout/client_side_operations_timeout.spec.test.ts b/test/integration/client-side-operations-timeout/client_side_operations_timeout.spec.test.ts index ed8e2e801bd..d1f2ad69c0e 100644 --- a/test/integration/client-side-operations-timeout/client_side_operations_timeout.spec.test.ts +++ b/test/integration/client-side-operations-timeout/client_side_operations_timeout.spec.test.ts @@ -10,8 +10,6 @@ const skippedTests = { 'command is not sent if RTT is greater than timeoutMS': 'TODO(DRIVERS-2965)', 'Non-tailable cursor iteration timeoutMS is refreshed for getMore if timeoutMode is iteration - failure': 'TODO(DRIVERS-2965)', - 'Non-tailable cursor lifetime remaining timeoutMS applied to getMore if timeoutMode is unset': - 'TODO(DRIVERS-2965)', 'maxTimeMS value in the command is less than timeoutMS': 'TODO(DRIVERS-2970): see modified test in unified-csot-node-specs', 'timeoutMS is refreshed for getMore - failure':