diff options
author | Max Hirschhorn <max.hirschhorn@mongodb.com> | 2018-04-26 00:03:02 -0400 |
---|---|---|
committer | Max Hirschhorn <max.hirschhorn@mongodb.com> | 2018-04-26 00:03:02 -0400 |
commit | 75e45cbf7437cef425f7c01b3099475e0e01f478 (patch) | |
tree | 1c14a9ebd624b8a6f2bdb4902b6cc6f1862414a0 /jstests/noPassthrough/data_consistency_checks.js | |
parent | d62890ffeacd2e911ff4a36f01bdef498c101c07 (diff) | |
download | mongo-75e45cbf7437cef425f7c01b3099475e0e01f478.tar.gz |
SERVER-34667 Run validate command against config.collections.
Changes the data_consistency_checks.js test to shard a collection to
ensure the config.collections collection exists.
Diffstat (limited to 'jstests/noPassthrough/data_consistency_checks.js')
-rw-r--r-- | jstests/noPassthrough/data_consistency_checks.js | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/jstests/noPassthrough/data_consistency_checks.js b/jstests/noPassthrough/data_consistency_checks.js index 19ec279dfd9..dcddefaf882 100644 --- a/jstests/noPassthrough/data_consistency_checks.js +++ b/jstests/noPassthrough/data_consistency_checks.js @@ -124,9 +124,13 @@ var db; configOptions: { setParameter: {logComponentVerbosity: tojson({command: 1})}, }, - shards: 0 + shards: 1 }); + // We shard a collection in order to guarantee that at least one collection on the "config" + // database exists for when we go to run the data consistency checks against the CSRS. + st.shardColl(st.s.getDB("test").mycoll, {_id: 1}, false); + const output = runDataConsistencyChecks({conn: st.s, teardown: () => st.stop()}); let pattern = makePatternForDBHash("config"); @@ -134,7 +138,10 @@ var db; countMatches(pattern, output), "expected not to find " + tojson(pattern) + " in the log output for 1-node CSRS"); - pattern = makePatternForValidate("config", "mongos"); + // The choice of using the "config.collections" collection here is mostly arbitrary as the + // "config.databases" and "config.chunks" collections are also implicitly created as part of + // sharding a collection. + pattern = makePatternForValidate("config", "collections"); assert.eq(1, countMatches(pattern, output), "expected to find " + tojson(pattern) + " in the log output for 1-node CSRS"); @@ -154,9 +161,13 @@ var db; } }); + // We shard a collection in order to guarantee that at least one collection on the "config" + // database exists for when we go to run the data consistency checks against the CSRS. + st.shardColl(st.s.getDB("test").mycoll, {_id: 1}, false); + // Insert a document so the "dbhash" and "validate" commands have some actual work to do on // the replica set shard. - assert.commandWorked(st.s.getDB("test").mycoll.insert({})); + assert.commandWorked(st.s.getDB("test").mycoll.insert({_id: 0})); const output = runDataConsistencyChecks({conn: st.s, teardown: () => st.stop()}); // The "config" database exists on both the CSRS and the replica set shards due to the @@ -167,7 +178,10 @@ var db; "expected to find " + tojson(pattern) + " from each CSRS node and each replica set shard node in the log output"); - pattern = makePatternForValidate("config", "mongos"); + // The choice of using the "config.collections" collection here is mostly arbitrary as the + // "config.databases" and "config.chunks" collections are also implicitly created as part of + // sharding a collection. + pattern = makePatternForValidate("config", "collections"); assert.eq(3, countMatches(pattern, output), "expected to find " + tojson(pattern) + " from each CSRS node in the log output"); |