Skip to content

Commit 2107200

Browse files
test(NODE-5068, NODE-5078): relax assertion on aggregate events in consecutive resume tests (#4449)
1 parent 67a1728 commit 2107200

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

test/integration/change-streams/change_stream.test.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { setTimeout } from 'timers';
88

99
import {
1010
type ChangeStream,
11+
type ChangeStreamDocument,
1112
type ChangeStreamOptions,
1213
type Collection,
1314
type CommandStartedEvent,
@@ -1955,7 +1956,9 @@ describe('ChangeStream resumability', function () {
19551956

19561957
expect(change).to.have.property('operationType', 'insert');
19571958

1958-
expect(aggregateEvents).to.have.lengthOf(6);
1959+
// More than one aggregate event indicates that the change stream attempted more than one
1960+
// resume attempt.
1961+
expect(aggregateEvents.length).to.be.greaterThan(1);
19591962
}
19601963
);
19611964
}
@@ -2147,7 +2150,9 @@ describe('ChangeStream resumability', function () {
21472150

21482151
expect(change).to.be.true;
21492152

2150-
expect(aggregateEvents).to.have.lengthOf(6);
2153+
// More than one aggregate event indicates that the change stream attempted more than one
2154+
// resume attempt.
2155+
expect(aggregateEvents.length).to.be.greaterThan(1);
21512156
}
21522157
);
21532158
}
@@ -2346,7 +2351,9 @@ describe('ChangeStream resumability', function () {
23462351
expect.fail(`expected tryNext to resume, received error instead: ${err}`);
23472352
}
23482353

2349-
expect(aggregateEvents).to.have.lengthOf(6);
2354+
// More than one aggregate event indicates that the change stream attempted more than one
2355+
// resume attempt.
2356+
expect(aggregateEvents.length).to.be.greaterThan(1);
23502357
}
23512358
);
23522359
}
@@ -2732,7 +2739,9 @@ describe('ChangeStream resumability', function () {
27322739
const [change] = (value as PromiseFulfilledResult<ChangeStreamDocument[]>).value;
27332740
expect(change).to.have.property('operationType', 'insert');
27342741

2735-
expect(aggregateEvents).to.have.lengthOf(6);
2742+
// More than one aggregate event indicates that the change stream attempted more than one
2743+
// resume attempt.
2744+
expect(aggregateEvents.length).to.be.greaterThan(1);
27362745
}
27372746
);
27382747
}

0 commit comments

Comments
 (0)