jstests/noPassthrough/sharded_index_consistency_metrics.js
/*
 * Asserts the serverStatus output for 'configPrimaryConn' has the expected number of collections
 * with inconsistent indexes and the output for 'configSecondaryConn' always reports 0. For each
 * mongod in 'connsWithoutIndexConsistencyMetrics', asserts that its serverStatus output does not
 * contain the index consistency metrics.
 */
Asserts the serverStatus output for 'configPrimaryConn' has the expected number of collections
with inconsistent indexes and the output for 'configSecondaryConn' always reports 0. For each
mongod in 'connsWithoutIndexConsistencyMetrics', asserts that its serverStatus output does not
contain the index consistency metrics.
Asserts the serverStatus output for ' configPrimaryConn ' has the expected number of collections with inconsistent indexes and the output for ' configSecondaryConn ' always reports 0 . For each mongod in ' connsWithoutIndexConsistencyMetrics ' asserts that its serverStatus output does not contain the index consistency metrics .
function checkServerStatus(configPrimaryConn,
                           configSecondaryConn,
                           connsWithoutIndexConsistencyMetrics,
                           expectedNumCollsWithInconsistentIndexes) {
    sleep(intervalMS * 2);
    checkServerStatusNumCollsWithInconsistentIndexes(configPrimaryConn,
                                                     expectedNumCollsWithInconsistentIndexes);
    checkServerStatusNumCollsWithInconsistentIndexes(configSecondaryConn, 0);
    for (const conn of connsWithoutIndexConsistencyMetrics) {
        assertServerStatusNotContainIndexMetrics(conn);
    }
}
function checkServerStatus ( configPrimaryConn , configSecondaryConn , connsWithoutIndexConsistencyMetrics , expectedNumCollsWithInconsistentIndexes ) { sleep ( intervalMS * 2 ) ; checkServerStatusNumCollsWithInconsistentIndexes ( configPrimaryConn , expectedNumCollsWithInconsistentIndexes ) ; checkServerStatusNumCollsWithInconsistentIndexes ( configSecondaryConn , 0 ) ; for ( const conn of connsWithoutIndexConsistencyMetrics ) { assertServerStatusNotContainIndexMetrics ( conn ) ; } }
Asserts the serverStatus output for 'configPrimaryConn' has the expected number of collections
 with inconsistent indexes and the output for 'configSecondaryConn' always reports 0.
Asserts the serverStatus output for ' configPrimaryConn ' has the expected number of collections with inconsistent indexes and the output for ' configSecondaryConn ' always reports 0 .
// Sleep to let the periodic check run. Note this won't guarantee the check has run, but should // make it likely enough to catch bugs in most test runs. // A config secondary should always report zero because only primaries run the aggregation to // find inconsistent indexes.