Skip to content
Snippets Groups Projects
Commit 1c2c03c9 authored by ananyabalagere's avatar ananyabalagere
Browse files

test 2 for proxy

parent 06b32fb6
No related branches found
No related tags found
No related merge requests found
......@@ -34,14 +34,30 @@ def basic_proxy(conductor: ClusterConductor, dir, log: Logger):
return True, "ok"
def partitioned_shards(conductor: ClusterConductor, dir, log: Logger):
def basic_proxy_partitioned_shards(conductor: ClusterConductor, dir, log: Logger, timeout= 5*DEFAULT_TIMEOUT):
with KVSTestFixture(conductor, dir, log, node_count=4) as fx:
c = KVSMultiClient(fx.clients, "client", log)
conductor.add_shard("shard1", conductor.get_nodes([0, 1]))
conductor.add_shard("shard2", conductor.get_nodes([2, 3]))
conductor.create_partition([2,3], "secondshard")
fx.broadcast_view(conductor.get_shard_view())
helper(c, timeout=timeout)
return True, "ok"
def helper(c: KVSMultiClient, timeout= 5*DEFAULT_TIMEOUT):
###
# test 2
# partition the shards
# put a bunch of keys
# we MUST probablistically encounter some hanging there.
# have a time out where if it doesnt hang after like 50 keys, then its just wrong.
return True, "ok"
node_to_put = 0
base_key = "key"
for i in range(0, 50):
r = c.put(node_to_put, f"{base_key}{i}", f"{i}", timeout=10)
assert r.ok or r.status_code == 408, f"expected ok for new key, got {r.status_code}"
node_to_put += 1
node_to_put = node_to_put % 4
PROXY_TESTS = [TestCase("basic_proxy", basic_proxy)]
\ No newline at end of file
PROXY_TESTS = [TestCase("basic_proxy", basic_proxy), TestCase("basic_proxy_partitioned_shards", basic_proxy_partitioned_shards)]
\ 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