diff options
author | Davis Haupt <davis.haupt@mongodb.com> | 2022-01-11 16:26:37 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-01-11 17:12:56 +0000 |
commit | 954c679f963b0e8e39010c748b53bd80e1109467 (patch) | |
tree | ac5ded961f4feeb70438f92ce97565cc61103ad3 /jstests | |
parent | 89bc7e2241fd1e2fcd34f7226a5d5f50b543d33f (diff) | |
download | mongo-954c679f963b0e8e39010c748b53bd80e1109467.tar.gz |
SERVER-59391 fault if LDAP facets are enabled but misconfigured
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/sharding/health_monitor/config_fault.js | 46 | ||||
-rw-r--r-- | jstests/sharding/health_monitor/parameters.js | 17 |
2 files changed, 55 insertions, 8 deletions
diff --git a/jstests/sharding/health_monitor/config_fault.js b/jstests/sharding/health_monitor/config_fault.js new file mode 100644 index 00000000000..219e7183126 --- /dev/null +++ b/jstests/sharding/health_monitor/config_fault.js @@ -0,0 +1,46 @@ +/* + * @tags: [requires_fcv_53] + */ + +(function() { +'use strict'; +const params = { + healthMonitoringIntensities: tojson({ + values: [ + {type: "test", intensity: "critical"}, + ] + }), +}; +const setFailPoint = { + 'failpoint.badConfigTestHealthObserver': "{'mode':'alwaysOn'}" +}; + +let st = new ShardingTest({ + mongos: [ + {setParameter: params}, + {setParameter: Object.assign({}, params, setFailPoint), waitForConnect: false} + ] +}); +assert.commandWorked(st.s0.adminCommand({"ping": 1})); // Ensure s0 is unaffected. +try { + conn = new Mongo("127.0.0.1:" + st.s1.port); + assert(false); +} catch (e) { + assert( + tojson(e).indexOf("network error") >= 0 || tojson(e).indexOf("couldn't connect to server"), + "connection should fail with network error: " + tojson(e)); +} +st.stop({skipValidatingExitCode: true}); + +// Verify that configuration doesn't matter when a health observer is off. +const offParams = { + healthMonitoringIntensities: tojson({ + values: [ + {type: "test", intensity: "off"}, + ] + }) +}; +st = new ShardingTest({mongos: [{setParameter: Object.assign({}, offParams, setFailPoint)}]}); +assert.commandWorked(st.s0.adminCommand({"ping": 1})); +st.stop(); +})(); diff --git a/jstests/sharding/health_monitor/parameters.js b/jstests/sharding/health_monitor/parameters.js index b73eb8f5446..624a6eafdd2 100644 --- a/jstests/sharding/health_monitor/parameters.js +++ b/jstests/sharding/health_monitor/parameters.js @@ -15,8 +15,8 @@ var st = new ShardingTest({ healthMonitoringIntensities: tojson({ values: [ {type: "dns", intensity: "off"}, - {type: "ldap", intensity: "critical"}, - {type: "test", intensity: "off"} + {type: "ldap", intensity: "off"}, + {type: "test", intensity: "critical"} ] }), } @@ -50,11 +50,12 @@ let getIntensity = (result, typeOfObserver) => { }; assert.eq(getIntensity(result, "dns"), "off"); -assert.eq(getIntensity(result, "ldap"), "critical"); +assert.eq(getIntensity(result, "ldap"), "off"); +assert.eq(getIntensity(result, "test"), "critical"); assert.commandWorked(st.s0.adminCommand({ "setParameter": 1, - healthMonitoringIntensities: {values: [{type: "dns", intensity: "critical"}]} + healthMonitoringIntensities: {values: [{type: "test", intensity: "non-critical"}]} })); assert.commandFailed(st.s0.adminCommand({ "setParameter": 1, @@ -65,16 +66,16 @@ assert.commandFailed(st.s0.adminCommand({ healthMonitoringIntensities: {values: [{type: "invalid", intensity: "off"}]} })); -// Tests that ldap param is unchanged after dns was changed. +// Tests that test param is unchanged after dns was changed. result = assert.commandWorked(st.s0.adminCommand({"getParameter": 1, healthMonitoringIntensities: 1})); -assert.eq(getIntensity(result, "dns"), "critical"); -assert.eq(getIntensity(result, "ldap"), "critical"); +assert.eq(getIntensity(result, "dns"), "off"); +assert.eq(getIntensity(result, "test"), "non-critical"); assert.commandWorked(st.s0.adminCommand({ "setParameter": 1, healthMonitoringIntensities: - {values: [{type: "dns", intensity: 'non-critical'}, {type: "ldap", intensity: 'off'}]} + {values: [{type: "dns", intensity: 'non-critical'}, {type: "test", intensity: 'off'}]} })); result = assert.commandWorked(st.s0.adminCommand({"getParameter": 1, healthMonitoringIntensities: 1})); |