From b42ec634255d92a9e70e746a29a8f8eb2e2ce398 Mon Sep 17 00:00:00 2001 From: bailey Date: Wed, 5 Mar 2025 09:00:32 -0700 Subject: [PATCH] relax assertion on aggregate events --- .../change-streams/change_stream.test.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/test/integration/change-streams/change_stream.test.ts b/test/integration/change-streams/change_stream.test.ts index a67b714ded2..aecdbbb7466 100644 --- a/test/integration/change-streams/change_stream.test.ts +++ b/test/integration/change-streams/change_stream.test.ts @@ -8,6 +8,7 @@ import { setTimeout } from 'timers'; import { type ChangeStream, + type ChangeStreamDocument, type ChangeStreamOptions, type Collection, type CommandStartedEvent, @@ -1955,7 +1956,9 @@ describe('ChangeStream resumability', function () { expect(change).to.have.property('operationType', 'insert'); - expect(aggregateEvents).to.have.lengthOf(6); + // More than one aggregate event indicates that the change stream attempted more than one + // resume attempt. + expect(aggregateEvents.length).to.be.greaterThan(1); } ); } @@ -2147,7 +2150,9 @@ describe('ChangeStream resumability', function () { expect(change).to.be.true; - expect(aggregateEvents).to.have.lengthOf(6); + // More than one aggregate event indicates that the change stream attempted more than one + // resume attempt. + expect(aggregateEvents.length).to.be.greaterThan(1); } ); } @@ -2346,7 +2351,9 @@ describe('ChangeStream resumability', function () { expect.fail(`expected tryNext to resume, received error instead: ${err}`); } - expect(aggregateEvents).to.have.lengthOf(6); + // More than one aggregate event indicates that the change stream attempted more than one + // resume attempt. + expect(aggregateEvents.length).to.be.greaterThan(1); } ); } @@ -2732,7 +2739,9 @@ describe('ChangeStream resumability', function () { const [change] = (value as PromiseFulfilledResult).value; expect(change).to.have.property('operationType', 'insert'); - expect(aggregateEvents).to.have.lengthOf(6); + // More than one aggregate event indicates that the change stream attempted more than one + // resume attempt. + expect(aggregateEvents.length).to.be.greaterThan(1); } ); }