Skip to content

Commit 0f05678

Browse files
authored
test(NODE-3076): run unified change stream tests (#2914)
1 parent e786b4d commit 0f05678

12 files changed

+27
-22
lines changed

test/functional/change_stream_spec.test.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,18 @@
22

33
const path = require('path');
44
const chai = require('chai');
5-
const loadSpecTests = require('../spec').loadSpecTests;
5+
const { loadSpecTests } = require('../spec');
6+
const { runUnifiedSuite } = require('./unified-spec-runner/runner');
67
const camelCase = require('lodash.camelcase');
7-
const setupDatabase = require('./shared').setupDatabase;
8-
const delay = require('./shared').delay;
8+
const { setupDatabase } = require('./shared');
9+
const { delay } = require('./shared');
910
const expect = chai.expect;
1011

11-
describe('Change Stream Spec', function () {
12+
describe('Change Streams Spec - Unified', function () {
13+
runUnifiedSuite(loadSpecTests(path.join('change-streams', 'unified')));
14+
});
15+
16+
describe('Change Stream Spec - v1', function () {
1217
let globalClient;
1318
let ctx;
1419
let events;
@@ -29,7 +34,7 @@ describe('Change Stream Spec', function () {
2934
return new Promise(r => gc.close(() => r()));
3035
});
3136

32-
loadSpecTests(path.join('change-stream', 'legacy')).forEach(suite => {
37+
loadSpecTests(path.join('change-streams', 'legacy')).forEach(suite => {
3338
const ALL_DBS = [suite.database_name, suite.database2_name];
3439

3540
describe(suite.name, () => {

test/spec/change-stream/legacy/change-streams-errors.yml renamed to test/spec/change-streams/legacy/change-streams-errors.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ tests:
8181
mode: { times: 1 }
8282
data:
8383
failCommands: ["getMore"]
84-
errorCode: 216 # An error code that's not on the old blacklist or whitelist
84+
errorCode: 216 # An error code that's not on the old deny or allow lists
8585
closeConnection: false
8686
target: collection
8787
topology:

test/spec/change-stream/legacy/change-streams-resume-whitelist.json renamed to test/spec/change-streams/legacy/change-streams-resume-allowlist.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@
778778
}
779779
},
780780
{
781-
"description": "change stream resumes after NotMaster",
781+
"description": "change stream resumes after NotWritablePrimary",
782782
"minServerVersion": "4.2",
783783
"maxServerVersion": "4.2.99",
784784
"failPoint": {
@@ -1069,7 +1069,7 @@
10691069
}
10701070
},
10711071
{
1072-
"description": "change stream resumes after NotMasterNoSlaveOk",
1072+
"description": "change stream resumes after NotPrimaryNoSecondaryOk",
10731073
"minServerVersion": "4.2",
10741074
"maxServerVersion": "4.2.99",
10751075
"failPoint": {
@@ -1166,7 +1166,7 @@
11661166
}
11671167
},
11681168
{
1169-
"description": "change stream resumes after NotMasterOrSecondary",
1169+
"description": "change stream resumes after NotPrimaryOrSecondary",
11701170
"minServerVersion": "4.2",
11711171
"maxServerVersion": "4.2.99",
11721172
"failPoint": {

test/spec/change-stream/legacy/change-streams-resume-whitelist.yml renamed to test/spec/change-streams/legacy/change-streams-resume-allowlist.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ tests:
522522
x:
523523
$numberInt: "1"
524524
-
525-
description: "change stream resumes after NotMaster"
525+
description: "change stream resumes after NotWritablePrimary"
526526
minServerVersion: "4.2"
527527
maxServerVersion: "4.2.99"
528528
failPoint:
@@ -717,7 +717,7 @@ tests:
717717
x:
718718
$numberInt: "1"
719719
-
720-
description: "change stream resumes after NotMasterNoSlaveOk"
720+
description: "change stream resumes after NotPrimaryNoSecondaryOk"
721721
minServerVersion: "4.2"
722722
maxServerVersion: "4.2.99"
723723
failPoint:
@@ -782,7 +782,7 @@ tests:
782782
x:
783783
$numberInt: "1"
784784
-
785-
description: "change stream resumes after NotMasterOrSecondary"
785+
description: "change stream resumes after NotPrimaryOrSecondary"
786786
minServerVersion: "4.2"
787787
maxServerVersion: "4.2.99"
788788
failPoint:

test/spec/change-stream/legacy/change-streams-resume-errorLabels.json renamed to test/spec/change-streams/legacy/change-streams-resume-errorLabels.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@
661661
}
662662
},
663663
{
664-
"description": "change stream resumes after NotMaster",
664+
"description": "change stream resumes after NotWritablePrimary",
665665
"minServerVersion": "4.3.1",
666666
"failPoint": {
667667
"configureFailPoint": "failGetMoreAfterCursorCheckout",
@@ -943,7 +943,7 @@
943943
}
944944
},
945945
{
946-
"description": "change stream resumes after NotMasterNoSlaveOk",
946+
"description": "change stream resumes after NotPrimaryNoSecondaryOk",
947947
"minServerVersion": "4.3.1",
948948
"failPoint": {
949949
"configureFailPoint": "failGetMoreAfterCursorCheckout",
@@ -1037,7 +1037,7 @@
10371037
}
10381038
},
10391039
{
1040-
"description": "change stream resumes after NotMasterOrSecondary",
1040+
"description": "change stream resumes after NotPrimaryOrSecondary",
10411041
"minServerVersion": "4.3.1",
10421042
"failPoint": {
10431043
"configureFailPoint": "failGetMoreAfterCursorCheckout",

test/spec/change-stream/legacy/change-streams-resume-errorLabels.yml renamed to test/spec/change-streams/legacy/change-streams-resume-errorLabels.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ tests:
451451
x:
452452
$numberInt: "1"
453453
-
454-
description: "change stream resumes after NotMaster"
454+
description: "change stream resumes after NotWritablePrimary"
455455
minServerVersion: "4.3.1"
456456
failPoint:
457457
configureFailPoint: failGetMoreAfterCursorCheckout
@@ -643,7 +643,7 @@ tests:
643643
x:
644644
$numberInt: "1"
645645
-
646-
description: "change stream resumes after NotMasterNoSlaveOk"
646+
description: "change stream resumes after NotPrimaryNoSecondaryOk"
647647
minServerVersion: "4.3.1"
648648
failPoint:
649649
configureFailPoint: failGetMoreAfterCursorCheckout
@@ -707,7 +707,7 @@ tests:
707707
x:
708708
$numberInt: "1"
709709
-
710-
description: "change stream resumes after NotMasterOrSecondary"
710+
description: "change stream resumes after NotPrimaryOrSecondary"
711711
minServerVersion: "4.3.1"
712712
failPoint:
713713
configureFailPoint: failGetMoreAfterCursorCheckout
@@ -1026,7 +1026,7 @@ tests:
10261026
fullDocument:
10271027
x:
10281028
$numberInt: "1"
1029-
# The next two tests ensure that the driver only uses the error label, not the whitelist.
1029+
# The next two tests ensure that the driver only uses the error label, not the allow list.
10301030
-
10311031
description: "change stream resumes if error contains ResumableChangeStreamError"
10321032
minServerVersion: "4.3.1"
@@ -1035,7 +1035,7 @@ tests:
10351035
mode: { times: 1 }
10361036
data:
10371037
failCommands: ["getMore"]
1038-
errorCode: 50 # Use an error code that does not have the whitelist label by default
1038+
errorCode: 50 # Use an error code that does not have the allow list label by default
10391039
closeConnection: false
10401040
errorLabels: ["ResumableChangeStreamError"]
10411041
target: collection
@@ -1097,11 +1097,11 @@ tests:
10971097
description: "change stream does not resume if error does not contain ResumableChangeStreamError"
10981098
minServerVersion: "4.3.1"
10991099
failPoint:
1100-
configureFailPoint: failCommand # failCommand will not add the whitelist error label
1100+
configureFailPoint: failCommand # failCommand will not add the allow list error label
11011101
mode: { times: 1 }
11021102
data:
11031103
failCommands: ["getMore"]
1104-
errorCode: 6 # Use an error code that is on the whitelist
1104+
errorCode: 6 # Use an error code that is on the allow list
11051105
closeConnection: false
11061106
target: collection
11071107
topology:

0 commit comments

Comments
 (0)