blob: 490e4a3eb2b7eaa16b512deef230ed90c800acf8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
// Test that verifies getDiagnosticData returns FTDC data
(function() {
"use strict";
// Verify we require admin database
assert.commandFailed(db.diagdata.runCommand("getDiagnosticData"));
// We need to retry a few times if run this test immediately after mongod is started as FTDC may
// not have run yet.
var foundGoodDocument = false;
for (var i = 0; i < 60; ++i) {
var result = db.adminCommand("getDiagnosticData");
assert.commandWorked(result);
var data = result.data;
if (!data.hasOwnProperty("start")) {
// Wait a little longer for FTDC to start
sleep(500);
} else {
// Check for a few common properties to ensure we got data
assert(data.hasOwnProperty("serverStatus"),
"does not have 'serverStatus' in '" + tojson(data) + "'");
assert(data.hasOwnProperty("end"), "does not have 'end' in '" + tojson(data) + "'");
foundGoodDocument = true;
}
}
assert(foundGoodDocument,
"getDiagnosticData failed to return a non-empty command, is FTDC running?");
})();
|