In ShardingTest::awaitBalancerRound fails, it outputs "Latest balancer statusundefined".
[js_test:tag_auto_split_partial_key] 2016-08-23T19:23:14.225+0000 2016-08-23T19:23:14.224+0000 E QUERY [thread1] Error: assert.soon failed, msg:Latest balancer statusundefined : [js_test:tag_auto_split_partial_key] 2016-08-23T19:23:14.225+0000 doassert@src/mongo/shell/assert.js:15:14 [js_test:tag_auto_split_partial_key] 2016-08-23T19:23:14.225+0000 assert.soon@src/mongo/shell/assert.js:176:13 [js_test:tag_auto_split_partial_key] 2016-08-23T19:23:14.225+0000 ShardingTest/this.awaitBalancerRound@src/mongo/shell/shardingtest.js:573:1 [js_test:tag_auto_split_partial_key] 2016-08-23T19:23:14.225+0000 @jstests/sharding/tag_auto_split_partial_key.js:22:5 [js_test:tag_auto_split_partial_key] 2016-08-23T19:23:14.225+0000 @jstests/sharding/tag_auto_split_partial_key.js:2:2 [js_test:tag_auto_split_partial_key] 2016-08-23T19:23:14.225+0000 failed to load: jstests/sharding/tag_auto_split_partial_key.js
In order to include the current balancer status in the assertion message, it is necessary to pass a function as the msg parameter to assert.soon().
diff --git a/src/mongo/shell/shardingtest.js b/src/mongo/shell/shardingtest.js index 6c3a67a..ac96291 100644 --- a/src/mongo/shell/shardingtest.js +++ b/src/mongo/shell/shardingtest.js @@ -570,10 +570,15 @@ var ShardingTest = function(params) { var initialStatus = getBalancerStatus(); var currentStatus; - assert.soon(function() { - currentStatus = getBalancerStatus(); - return (currentStatus.numBalancerRounds - initialStatus.numBalancerRounds) != 0; - }, 'Latest balancer status' + currentStatus, timeoutMs); + assert.soon( + function() { + currentStatus = getBalancerStatus(); + return (currentStatus.numBalancerRounds - initialStatus.numBalancerRounds) != 0; + }, + function() { + return 'Latest balancer status: ' + tojson(currentStatus); + }, + timeoutMs); }; /**