diff options
Diffstat (limited to 'jstests/noPassthrough/ttl_expire_nan_warning_on_startup.js')
-rw-r--r-- | jstests/noPassthrough/ttl_expire_nan_warning_on_startup.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/jstests/noPassthrough/ttl_expire_nan_warning_on_startup.js b/jstests/noPassthrough/ttl_expire_nan_warning_on_startup.js index d4b1d41f1fe..a285adc69a5 100644 --- a/jstests/noPassthrough/ttl_expire_nan_warning_on_startup.js +++ b/jstests/noPassthrough/ttl_expire_nan_warning_on_startup.js @@ -10,6 +10,7 @@ (function() { 'use strict'; +load("jstests/libs/fail_point_util.js"); load('jstests/noPassthrough/libs/index_build.js'); const rst = new ReplSetTest({nodes: [{}, {rsConfig: {votes: 0, priority: 0}}]}); @@ -20,7 +21,16 @@ let primary = rst.getPrimary(); const db = primary.getDB('test'); const coll = db.t; -assert.commandWorked(coll.createIndex({t: 1}, {expireAfterSeconds: NaN})); +// The test cases here revolve around having a TTL index in the catalog with a NaN +// 'expireAfterSeconds'. The current createIndexes behavior will overwrite NaN with int32::max +// unless we use a fail point. +const fp = configureFailPoint(primary, 'skipTTLIndexNaNExpireAfterSecondsValidation'); +try { + assert.commandWorked(coll.createIndex({t: 1}, {expireAfterSeconds: NaN})); +} finally { + fp.off(); +} + assert.commandWorked(coll.insert({_id: 0, t: ISODate()})); // Force checkpoint in storage engine to ensure index is part of the catalog in |