diff options
author | Huayu Ouyang <huayu.ouyang@mongodb.com> | 2022-11-04 20:22:58 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-11-04 21:10:23 +0000 |
commit | 71656d100fc8eade83d02b603c011f1145feffde (patch) | |
tree | 8bbba0041157581135267bee84d15475e4f37344 /jstests | |
parent | 48a77e1d991933dcc182fe34e335a6d34bbddc55 (diff) | |
download | mongo-71656d100fc8eade83d02b603c011f1145feffde.tar.gz |
SERVER-71091 Fix null type error in set_fcv_logging.js
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/sharding/set_fcv_logging.js | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/jstests/sharding/set_fcv_logging.js b/jstests/sharding/set_fcv_logging.js index 3ca118e9649..99e3aa38849 100644 --- a/jstests/sharding/set_fcv_logging.js +++ b/jstests/sharding/set_fcv_logging.js @@ -43,23 +43,23 @@ function assertLogs(status, upgradeOrDowngrade, serverType, numShardServers) { } if (serverType === "replica set/standalone") { - assert.soon( - () => - rawMongoProgramOutput().match(/\"serverType\":"replica set\/standalone"/g).length == - status, - "should have " + status + " log(s) with serverType: replica set/standalone"); + assert.soon(() => { + let matchRes = + rawMongoProgramOutput().match(/\"serverType\":"replica set\/standalone"/g); + return matchRes != null && matchRes.length == status; + }, "should have " + status + " log(s) with serverType: replica set/standalone"); } else if (serverType === "shardedCluster") { - assert.soon( - () => rawMongoProgramOutput().match(/\"serverType\":"config server"/g).length == status, - "should have " + status + " log(s) with serverType: config server"); + assert.soon(() => { + let matchRes = rawMongoProgramOutput().match(/\"serverType\":"config server"/g); + return matchRes != null && matchRes.length == status; + }, "should have " + status + " log(s) with serverType: config server"); // If the FCV change failed before the config server reached the transitioning state, // there should not be any logs containing 'shard server'. if (status >= SetFCVStatus.transitioning) { - assert.soon( - () => rawMongoProgramOutput().match(/\"serverType\":"shard server"/g).length == - numShardServers * status, - "should have " + numShardServers * status + - " log(s) with serverType: shard server"); + assert.soon(() => { + let matchRes = rawMongoProgramOutput().match(/\"serverType\":"shard server"/g); + return matchRes != null && matchRes.length == numShardServers * status; + }, "should have " + numShardServers * status + " log(s) with serverType: shard server"); } else { assert(rawMongoProgramOutput().match(/\"serverType\":"shard server"/g) == null, 'should not have log containing shard server'); |