summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/change_stream_only_generates_v1_tokens_with_test_commands_disabled.js
blob: 2a1fe1fbad06dbbe94b99a92632c792ba8a81b77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/**
 * Test that the $_generateV2ResumeTokens parameter cannot be used when test commands are disabled.
 * @tags: [
 *   uses_change_streams,
 *   requires_sharding,
 *   requires_replication,
 *   requires_wiredtiger,
 * ]
 */
(function() {
"use strict";

// Signal to the ShardingTest that we want to disable test commands.
TestData.enableTestCommands = false;

// Create a sharding fixture with test commands disabled.
const st = new ShardingTest({shards: 1, rs: {nodes: 1}});

// Confirm that attempting to run change streams with $_generateV2ResumeTokens:true fails on mongos.
assert.throwsWithCode(() => st.s.watch([], {$_generateV2ResumeTokens: true}).hasNext(), 6528201);

// Confirm that attempting to run change streams with $_generateV2ResumeTokens:true fails on shards.
assert.throwsWithCode(
    () => st.rs0.getPrimary().watch([], {$_generateV2ResumeTokens: true}).hasNext(), 6528200);

st.stop();
})();