def run(self, failure_factory): cluster = RedpandaDuckCluster(self.service, self.redpanda_mu) workload_factory = lambda: MRSWWorkload( list(map(lambda x: KVNode(x, x), self.kafkakv_mu.endpoints)), 3, 3, []) asyncio.run( inject_recover_scenario_aio(BaseChaosTest.PERSISTENT_ROOT, self.config, cluster, workload_factory, failure_factory))
def workload_factory(config): nodes = [] for endpoint in config["endpoints"]: host = endpoint["host"] port = endpoint["httpport"] address = f"{host}:{port}" nodes.append(KVNode(endpoint["idx"], endpoint["id"], address)) if config["workload"]["name"] == "mrsw": return MRSWWorkload(nodes, config["writers"], config["readers"], config["ss_metrics"]) elif config["workload"]["name"] == "comrmw": return COMRMWWorkload(config["workload"]["period_s"], nodes, config["writers"], config["readers"], config["ss_metrics"]) else: raise Exception("Unknown workload: " + config["workload"]["name"])
async def is_ok(self): is_ok = False for endpoint in self.config["endpoints"]: host = endpoint["host"] port = endpoint["httpport"] address = f"{host}:{port}" kv = KVNode(address, address) try: await kv.put_aio("test", "value1", "wid1") is_ok = True except RequestTimedout: # TODO add logging pass except RequestCanceled: pass await kv.close_aio() if is_ok: return True return is_ok
async def is_ok(self): is_ok = False for endpoint in self.config["endpoints"]: host = endpoint["host"] port = endpoint["httpport"] address = f"{host}:{port}" kv = KVNode(address, address) try: await kv.put_aio("test", "value1", "wid1") is_ok = True except RequestTimedout: chaos_event_log.info( m(f"put request to {address} timed out").with_time()) pass except RequestCanceled: pass await kv.close_aio() if is_ok: return True return is_ok
def workload_factory(): nodes = [] for x in self.kafkakv_mu.endpoints: nodes.append(KVNode(len(nodes), x, x)) return MRSWWorkload(nodes, 3, 3, [])