diff options
author | Rui Liu <rui.liu@mongodb.com> | 2022-04-05 10:29:29 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-04-05 11:28:56 +0000 |
commit | 37bc1e516efc310d8e35d223ca3639f83ca46698 (patch) | |
tree | b0e2a3109be3e011fd43244c0cae2739fe0eb459 /jstests | |
parent | 865b891e92e201dc4a3e65e37524b13cfccb38a4 (diff) | |
download | mongo-37bc1e516efc310d8e35d223ca3639f83ca46698.tar.gz |
SERVER-65212 Split upgrade_downgrade_timeseries_granularity_update.js into last-lts and last-continuous tests
Diffstat (limited to 'jstests')
2 files changed, 41 insertions, 1 deletions
diff --git a/jstests/multiVersion/targetedTestsLastContinuousFeatures/upgrade_downgrade_timeseries_granularity_update.js b/jstests/multiVersion/targetedTestsLastContinuousFeatures/upgrade_downgrade_timeseries_granularity_update.js new file mode 100644 index 00000000000..0dbe91595b9 --- /dev/null +++ b/jstests/multiVersion/targetedTestsLastContinuousFeatures/upgrade_downgrade_timeseries_granularity_update.js @@ -0,0 +1,41 @@ +/** + * Tests that granularity update for sharded time-series collections is disabled for FCV < 6.0 + */ +(function() { +"use strict"; + +load('./jstests/multiVersion/libs/multi_cluster.js'); + +function runTest(downgradeVersion) { + const st = new ShardingTest({shards: 1}); + const dbName = "test"; + const collName = jsTestName(); + const viewNss = `${dbName}.${collName}`; + const timeField = "time"; + const metaField = "meta"; + const mongos = st.s; + const db = mongos.getDB(dbName); + + assert.commandWorked(mongos.adminCommand({enableSharding: dbName})); + assert.commandWorked(db.createCollection( + collName, + {timeseries: {timeField: timeField, metaField: metaField, granularity: 'seconds'}})); + assert.commandWorked(mongos.adminCommand({ + shardCollection: viewNss, + key: {[metaField]: 1}, + })); + + // Granularity updates works in 6.0 + assert.commandWorked(db.runCommand({collMod: collName, timeseries: {granularity: 'minutes'}})); + + // Granularity updates fails after downgrading. + assert.commandWorked(st.s.adminCommand({setFeatureCompatibilityVersion: downgradeVersion})); + assert.commandFailedWithCode( + db.runCommand({collMod: collName, timeseries: {granularity: 'hours'}}), + ErrorCodes.NotImplemented); + + st.stop(); +} + +runTest(lastContinuousFCV); +})(); diff --git a/jstests/multiVersion/targetedTestsLastLtsFeatures/upgrade_downgrade_timeseries_granularity_update.js b/jstests/multiVersion/targetedTestsLastLtsFeatures/upgrade_downgrade_timeseries_granularity_update.js index 354dea0f820..59d6efebdee 100644 --- a/jstests/multiVersion/targetedTestsLastLtsFeatures/upgrade_downgrade_timeseries_granularity_update.js +++ b/jstests/multiVersion/targetedTestsLastLtsFeatures/upgrade_downgrade_timeseries_granularity_update.js @@ -38,5 +38,4 @@ function runTest(downgradeVersion) { } runTest(lastLTSFCV); -runTest(lastContinuousFCV); })(); |