summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorAndrew Shuvalov <andrew.shuvalov@mongodb.com>2022-01-10 21:41:36 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-01-11 14:57:42 +0000
commite3c2d10228bcb64fbf0bc26e9c8468e47fa3677e (patch)
treec3dcd5486b3e535379185406b84614d0a4d659e8 /jstests
parente46858249a8449e9589bbb926ad367d092d71acc (diff)
downloadmongo-e3c2d10228bcb64fbf0bc26e9c8468e47fa3677e.tar.gz
SERVER-59375 SERVER-62373 additional serverStatus sections for health checks
(cherry picked from commit 386986a651b852c3c98b426ea60a023d99e4a5a4)
Diffstat (limited to 'jstests')
-rw-r--r--jstests/sharding/health_monitor/non_critical_facet.js3
-rw-r--r--jstests/sharding/health_monitor/server_status_health.js18
2 files changed, 16 insertions, 5 deletions
diff --git a/jstests/sharding/health_monitor/non_critical_facet.js b/jstests/sharding/health_monitor/non_critical_facet.js
index 6bedf771242..704f924c83b 100644
--- a/jstests/sharding/health_monitor/non_critical_facet.js
+++ b/jstests/sharding/health_monitor/non_critical_facet.js
@@ -49,8 +49,7 @@ sleep(ACTIVE_FAULT_DURATION_SECS * 2000);
// Still in transient fault.
result = assert.commandWorked(st.s0.adminCommand({serverStatus: 1})).health;
assert.eq(result.state, "TransientFault");
-assert(
- result.faultInformation.facets.kTestObserver.description.includes("InternalError: test msg"));
+assert(result.faultInformation.facets.testObserver.description.includes("InternalError: test msg"));
st.stop();
})();
diff --git a/jstests/sharding/health_monitor/server_status_health.js b/jstests/sharding/health_monitor/server_status_health.js
index 6a146d87eba..09e9b74390b 100644
--- a/jstests/sharding/health_monitor/server_status_health.js
+++ b/jstests/sharding/health_monitor/server_status_health.js
@@ -56,15 +56,16 @@ print("---RESULT 2---");
print(tojson(result));
assert(result.enteredStateAtTime);
assert(result.faultInformation);
+assert(result.testObserver.intensity);
const faultInformation = result.faultInformation;
assert.eq(faultInformation.severity, 1);
assert(faultInformation.duration);
assert(faultInformation.facets);
assert.eq(faultInformation.numFacets, 1);
-assert(faultInformation.facets.kTestObserver);
+assert(faultInformation.facets.testObserver);
-const kTestObserverFacet = faultInformation.facets.kTestObserver;
+const kTestObserverFacet = faultInformation.facets.testObserver;
assert.eq(kTestObserverFacet.severity, faultInformation.severity);
assert.eq(kTestObserverFacet.duration, faultInformation.duration);
assert(kTestObserverFacet.description.includes("InternalError: test msg"));
@@ -78,11 +79,22 @@ assert.soon(() => {
return result.state == "Ok";
});
-result = assert.commandWorked(st.s0.adminCommand({serverStatus: 1})).health;
print("---RESULT 3---");
+result = assert.commandWorked(st.s0.adminCommand({serverStatus: 1})).health;
print(tojson(result));
assert.eq(result.state, "Ok");
assert(result.enteredStateAtTime);
+print("---RESULT 4 with details---");
+result =
+ assert.commandWorked(st.s0.adminCommand({serverStatus: 1, health: {details: true}})).health;
+print(tojson(result));
+const testObserver = result.testObserver;
+assert(testObserver.totalChecks);
+assert(testObserver.totalChecks >= 1);
+assert(testObserver.totalChecksWithFailure >= 1);
+assert(testObserver.timeSinceLastCheckStartedMs >= 1);
+assert(testObserver.timeSinceLastCheckCompletedMs >= 1);
+
st.stop();
})();