Example #1
0
async def run(config_json, n, overrides):
    suite_id = int(time.time())

    with open(config_json, "r") as settings_json:
        config = json.load(settings_json)

    init_output(config, suite_id)

    shutil.copyfile(
        config_json, path.join(config["output"], str(suite_id),
                               "settings.json"))

    if overrides:
        for overide in overrides:
            [key, value] = overide.split("=", 1)
            config[key] = json.loads(value)

    faults = {fault: known_faults[fault] for fault in config["faults"]}

    with RedpandaCluster(config) as cluster:
        try:
            for _ in range(0, n):
                if not config["reset_before_test"]:
                    await cluster.restart()
                    if not await cluster.is_ok():
                        chaos_event_log.info(
                            m(f"cluster isn't healthy").with_time())
                        raise Exception(f"cluster isn't healthy")
                await inject_recover_scenarios_aio(
                    suite_id, config, cluster, faults,
                    lambda: workload_factory(config))
        except ViolationInducedExit:
            pass
Example #2
0
async def run(config, n, overrides):
    init_output(config)

    if overrides:
        for overide in overrides:
            [key, value] = overide.split("=", 1)
            config[key] = json.loads(value)

    faults = {fault: known_faults[fault] for fault in config["faults"]}

    with RedpandaCluster(config) as cluster:
        try:
            for _ in range(0, n):
                if not config["reset_before_test"]:
                    await cluster.restart()
                    if not await cluster.is_ok():
                        chaos_event_log.info(
                            m(f"cluster isn't healthy").with_time())
                        raise Exception(f"cluster isn't healthy")
                await inject_recover_scenarios_aio(
                    config, cluster, faults, lambda: workload_factory(config))
        except ViolationInducedExit:
            pass