diff options
Diffstat (limited to 'jstests/sharding/explain_read_pref.js')
-rw-r--r-- | jstests/sharding/explain_read_pref.js | 46 |
1 files changed, 20 insertions, 26 deletions
diff --git a/jstests/sharding/explain_read_pref.js b/jstests/sharding/explain_read_pref.js index cdf1d1e74a4..8ac4fc4ff49 100644 --- a/jstests/sharding/explain_read_pref.js +++ b/jstests/sharding/explain_read_pref.js @@ -32,28 +32,28 @@ var testAllModes = function(conn, isMongos) { // { tag: 'two' } so we can test the interaction of modes and tags. Test // a bunch of combinations. [ - // mode, tagSets, expectedHost - ['primary', undefined, false], - ['primary', [{}], false], + // mode, tagSets, expectedHost + ['primary', undefined, false], + ['primary', [{}], false], - ['primaryPreferred', undefined, false], - ['primaryPreferred', [{tag: 'one'}], false], - // Correctly uses primary and ignores the tag - ['primaryPreferred', [{tag: 'two'}], false], + ['primaryPreferred', undefined, false], + ['primaryPreferred', [{tag: 'one'}], false], + // Correctly uses primary and ignores the tag + ['primaryPreferred', [{tag: 'two'}], false], - ['secondary', undefined, true], - ['secondary', [{tag: 'two'}], true], - ['secondary', [{tag: 'doesntexist'}, {}], true], - ['secondary', [{tag: 'doesntexist'}, {tag: 'two'}], true], + ['secondary', undefined, true], + ['secondary', [{tag: 'two'}], true], + ['secondary', [{tag: 'doesntexist'}, {}], true], + ['secondary', [{tag: 'doesntexist'}, {tag: 'two'}], true], - ['secondaryPreferred', undefined, true], - ['secondaryPreferred', [{tag: 'one'}], false], - ['secondaryPreferred', [{tag: 'two'}], true], + ['secondaryPreferred', undefined, true], + ['secondaryPreferred', [{tag: 'one'}], false], + ['secondaryPreferred', [{tag: 'two'}], true], - // We don't have a way to alter ping times so we can't predict where an - // untagged 'nearest' command should go, hence only test with tags. - ['nearest', [{tag: 'one'}], false], - ['nearest', [{tag: 'two'}], true] + // We don't have a way to alter ping times so we can't predict where an + // untagged 'nearest' command should go, hence only test with tags. + ['nearest', [{tag: 'one'}], false], + ['nearest', [{tag: 'two'}], true] ].forEach(function(args) { var mode = args[0], tagSets = args[1], secExpected = args[2]; @@ -101,14 +101,8 @@ ReplSetTest.awaitRSClientHosts(st.s, st.rs0.nodes); // Tag primary with { dc: 'ny', tag: 'one' }, secondary with { dc: 'ny', tag: 'two' } var primary = st.rs0.getPrimary(); var secondary = st.rs0.getSecondary(); -var PRIMARY_TAG = { - dc: 'ny', - tag: 'one' -}; -var SECONDARY_TAG = { - dc: 'ny', - tag: 'two' -}; +var PRIMARY_TAG = {dc: 'ny', tag: 'one'}; +var SECONDARY_TAG = {dc: 'ny', tag: 'two'}; var rsConfig = primary.getDB("local").system.replset.findOne(); jsTest.log('got rsconf ' + tojson(rsConfig)); |