summaryrefslogtreecommitdiff
path: root/jstests/sharding/balancer_collection_status.js
diff options
context:
space:
mode:
authorMarcos José Grillo Ramírez <marcos.grillo@10gen.com>2019-11-26 19:00:51 +0000
committerevergreen <evergreen@mongodb.com>2019-11-26 19:00:51 +0000
commit2b70f6f0d7cf33dd387b50141992362fc4e2fcf8 (patch)
tree363faeab81f66786be0c2cea2c68ed2e7cd9d8fb /jstests/sharding/balancer_collection_status.js
parentfe1ab54ab292bbd880cb26317e3fa104fd72890c (diff)
downloadmongo-2b70f6f0d7cf33dd387b50141992362fc4e2fcf8.tar.gz
SERVER-44818 Change the balancerCollectionStatus command response format
Diffstat (limited to 'jstests/sharding/balancer_collection_status.js')
-rw-r--r--jstests/sharding/balancer_collection_status.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/jstests/sharding/balancer_collection_status.js b/jstests/sharding/balancer_collection_status.js
index e1cbb8f48c0..008e4c939a4 100644
--- a/jstests/sharding/balancer_collection_status.js
+++ b/jstests/sharding/balancer_collection_status.js
@@ -44,7 +44,7 @@ assert.commandFailedWithCode(st.s0.adminCommand({balancerCollectionStatus: 'db.c
var result = assert.commandWorked(st.s0.adminCommand({balancerCollectionStatus: 'db.col'}));
// new collections must be balanced
-assert.eq(result.status, 'balanced');
+assert.eq(result.balancerCompliant, true);
// get shardIds
var shards = st.s0.getDB('config').shards.find().toArray();
@@ -60,7 +60,8 @@ assert.commandWorked(st.s0.adminCommand({moveChunk: 'db.col', find: {key: 20}, t
result = assert.commandWorked(st.s0.adminCommand({balancerCollectionStatus: 'db.col'}));
// chunksImbalanced expected
-assert.eq(result.status, 'chunksImbalance');
+assert.eq(result.balancerCompliant, false);
+assert.eq(result.firstComplianceViolation, 'chunksImbalance');
// run balancer with 3 rounds
runBalancer(3);
@@ -68,7 +69,7 @@ runBalancer(3);
// the chunks must be balanced now
result = assert.commandWorked(st.s0.adminCommand({balancerCollectionStatus: 'db.col'}));
-assert.eq(result.status, 'balanced');
+assert.eq(result.balancerCompliant, true);
// manually move a chunk to a shard before creating zones (this will help
// testing the zone violation)
@@ -86,7 +87,8 @@ assert.commandWorked(st.s0.adminCommand(
result = assert.commandWorked(st.s0.adminCommand({balancerCollectionStatus: 'db.col'}));
// having a chunk on a different zone will cause a zone violation
-assert.eq(result.status, 'zoneViolation');
+assert.eq(result.balancerCompliant, false);
+assert.eq(result.firstComplianceViolation, 'zoneViolation');
// run balancer, we don't know exactly where the first run moved the chunks
// so lets run 3 rounds just in case
@@ -95,8 +97,8 @@ runBalancer(3);
// the chunks must be balanced now
result = assert.commandWorked(st.s0.adminCommand({balancerCollectionStatus: 'db.col'}));
-// final check: all chunks are balanced and in the correct zone
-assert.eq(result.status, 'balanced');
+// All chunks are balanced and in the correct zone
+assert.eq(result.balancerCompliant, true);
st.stop();
})(); \ No newline at end of file