Skip to content
Snippets Groups Projects
Commit 6b274dfd authored by ananyabalagere's avatar ananyabalagere
Browse files

shuffle two

parent 554d424f
No related branches found
No related tags found
No related merge requests found
...@@ -122,13 +122,32 @@ def basic_shuffle_2(conductor: ClusterConductor, dir, log: Logger): ...@@ -122,13 +122,32 @@ def basic_shuffle_2(conductor: ClusterConductor, dir, log: Logger):
r = c.put(node_to_put, f"{base_key}{i}", f"{i}", timeout=10) r = c.put(node_to_put, f"{base_key}{i}", f"{i}", timeout=10)
assert r.ok, f"expected ok for new key, got {r.status_code}" assert r.ok, f"expected ok for new key, got {r.status_code}"
node_to_put += 1 node_to_put += 1
node_to_put = node_to_put % 4 node_to_put = node_to_put % 3
r = c.get_all(0, timeout=10) # should get all of shard 1's keys r = c.get_all(0, timeout=10) # should get all of shard 1's keys
assert r.ok, f"expected ok for get, got {r.status_code}" assert r.ok, f"expected ok for get, got {r.status_code}"
original_get_all = r.json()["items"] original_get_all = r.json()["items"]
conductor.add_shard("shard2", conductor.get_nodes([2])) conductor.add_shard("shard2", conductor.get_nodes([2]))
fx.broadcast_view(conductor.get_shard_view())
r = c.get_all(2, timeout=10) # should get all of shard 2's keys
assert r.ok, f"expected ok for get, got {r.status_code}"
get_all_1 = r.json()["items"]
keys1 = get_all_1.keys()
r = c.get_all(1, timeout=10) # should get all of shard 1's keys
assert r.ok, f"expected ok for get, got {r.status_code}"
get_all_2 = r.json()["items"]
keys2 = get_all_2.keys()
for key in keys1:
assert not (key in keys2)
for key in keys2:
assert not (key in keys1)
assert original_get_all.keys() == keys1 + keys2
return True, "ok" return True, "ok"
SHUFFLE_TESTS = [TestCase("shuffle_basic", basic_shuffle)] SHUFFLE_TESTS = [TestCase("basic_shuffle", basic_shuffle), TestCase("basic_shuffle_2", basic_shuffle_2)]
\ No newline at end of file \ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment