assertr.ok,f"expected ok for new key, got {r.status_code}"
conductor.create_partition([0,1],"p0")
conductor.create_partition([2,3],"p1")
r=c2.get_all(0)
assertr.ok,f"expected ok for new key, got {r.status_code}"
shard1_keys=r.json()["items"]
r=c3.get_all(2)
assertr.ok,f"expected ok for new key, got {r.status_code}"
shard2_keys=r.json()["items"]
print(shard1_keys)
print(shard2_keys)
assert ((len(shard1_keys)>0)and(len(shard2_keys)>0)),"One of the shards has no keys, this is extremely unlikely (1/2^11) and probably means something is wrong"
rk1=list(shard1_keys.keys())[0]
rk2=list(shard2_keys.keys())[0]
r=c4.put(0,rk2,"This should fail")
assertr.status_code==408,f"expected 408 for new key, got {r.status_code}"
r=c4.put(2,rk1,"This should also fail")
assertr.status_code==408,f"expected 408 for new key, got {r.status_code}"
conductor.create_partition([0,1,2,3],"base")
r=c4.put(0,rk2,"This should work")
assertr.ok,f"expected ok for new key, got {r.status_code}"
r=c4.put(2,rk1,"This should also work")
assertr.ok,f"expected ok for new key, got {r.status_code}"
r=c2.get_all(0)
assertr.ok,f"expected ok for new key, got {r.status_code}"
shard1_keys=r.json()["items"]
r=c3.get_all(2)
assertr.ok,f"expected ok for new key, got {r.status_code}"
shard2_keys=r.json()["items"]
print(shard1_keys)
print(shard2_keys)
assert (len(shard1_keys)>0andlen(shard2_keys)>0),"One of the shards has no keys, this is extremely unlikely (1/2^11) and probably means something is wrong"