Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-26095

ShardingTest::awaitBalancerRound logs the error msg incorrectly with assert.soon

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.3.14
    • Component/s: Sharding
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Sprint:
      Sharding 2016-09-19
    • Linked BF Score:
      0

      Description

      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);
           };
       
           /**
      

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: