diff options
author | Gregory Noma <gregory.noma@gmail.com> | 2021-04-21 12:49:27 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-04-21 17:25:41 +0000 |
commit | e9279fb3d14f203842c8dc1e348c73cdc7eb10c5 (patch) | |
tree | ef7239b4933b0c173caafa74fee144ab0019e761 /jstests/noPassthrough/timeseries_create_index_option_defaults.js | |
parent | 895c9a4ae9f77a7de2d5537bfd111d9d15c60847 (diff) | |
download | mongo-e9279fb3d14f203842c8dc1e348c73cdc7eb10c5.tar.gz |
SERVER-53889 Enable time-series feature flag by default
Diffstat (limited to 'jstests/noPassthrough/timeseries_create_index_option_defaults.js')
-rw-r--r-- | jstests/noPassthrough/timeseries_create_index_option_defaults.js | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/jstests/noPassthrough/timeseries_create_index_option_defaults.js b/jstests/noPassthrough/timeseries_create_index_option_defaults.js new file mode 100644 index 00000000000..02619425aee --- /dev/null +++ b/jstests/noPassthrough/timeseries_create_index_option_defaults.js @@ -0,0 +1,46 @@ +/** + * Tests that the indexOptionDefaults collection creation option is applied when creating indexes on + * a time-series collection. + * + * @tags: [ + * requires_fcv_49, + * requires_persistence, + * requires_wiredtiger, + * ] + */ +(function() { +'use strict'; + +load('jstests/core/timeseries/libs/timeseries.js'); + +const conn = MongoRunner.runMongod(); + +if (!TimeseriesTest.timeseriesCollectionsEnabled(conn)) { + jsTestLog('Skipping test because the time-series collection feature flag is disabled'); + MongoRunner.stopMongod(conn); + return; +} + +const testDB = conn.getDB('test'); +const coll = testDB.getCollection(jsTestName()); + +assert.commandFailedWithCode(testDB.createCollection(coll.getName(), { + timeseries: {timeField: 'tt', metaField: 'mm'}, + indexOptionDefaults: {storageEngine: {wiredTiger: {configString: 'invalid_option=xxx,'}}} +}), + ErrorCodes.BadValue); + +// Sample wiredtiger configuration option from wt_index_option_defaults.js. +assert.commandWorked(testDB.createCollection(coll.getName(), { + timeseries: {timeField: 'tt', metaField: 'mm'}, + indexOptionDefaults: {storageEngine: {wiredTiger: {configString: 'split_pct=88,'}}} +})); + +assert.commandWorked(coll.insert({tt: ISODate(), mm: 'aaa'})); +assert.commandWorked(coll.createIndex({mm: 1})); + +const indexCreationString = coll.stats({indexDetails: true}).indexDetails.mm_1.creationString; +assert.neq(-1, indexCreationString.indexOf(',split_pct=88,'), indexCreationString); + +MongoRunner.stopMongod(conn); +})(); |