From 1676383a0a51da8578e87e0e74231eac934ca02e Mon Sep 17 00:00:00 2001 From: Michal Maslanka Date: Wed, 6 Jul 2022 13:11:01 +0200 Subject: [PATCH] tests/node_op_fuzzy: do not create/delete topics As we are already using admin operations fuzzer to execute admin day-2 operations we may skip creating/deleting topics explicitly Signed-off-by: Michal Maslanka --- .../scale_tests/node_operations_fuzzy_test.py | 77 ++----------------- 1 file changed, 6 insertions(+), 71 deletions(-) diff --git a/tests/rptest/scale_tests/node_operations_fuzzy_test.py b/tests/rptest/scale_tests/node_operations_fuzzy_test.py index 94ee617209098..2cb8cf78832c0 100644 --- a/tests/rptest/scale_tests/node_operations_fuzzy_test.py +++ b/tests/rptest/scale_tests/node_operations_fuzzy_test.py @@ -27,8 +27,7 @@ DECOMMISSION = "decommission" ADD = "add" -ADD_TOPIC = "add_tp" -DELETE_TOPIC = "delete_tp" + ALLOWED_REPLICATION = [1, 3] @@ -37,19 +36,12 @@ class NodeOperationFuzzyTest(EndToEndTest): min_inter_failure_time = 30 max_inter_failure_time = 60 - def generate_random_workload(self, count, skip_nodes, available_nodes): + def generate_random_workload(self, count, available_nodes): op_types = [ADD, DECOMMISSION] - tp_op_types = [ADD_TOPIC, DELETE_TOPIC] # current state active_nodes = list(available_nodes) decommissioned_nodes = [] operations = [] - topics = [] - - def eligible_active_nodes(): - return list( - filter(lambda n: not (n == 1 or n in skip_nodes), - active_nodes)) def decommission(id): active_nodes.remove(id) @@ -60,37 +52,24 @@ def add(id): decommissioned_nodes.remove(id) for _ in range(0, count): - if len(decommissioned_nodes) == 2: + if len(active_nodes) <= 3: id = random.choice(decommissioned_nodes) operations.append((ADD, id)) add(id) elif len(decommissioned_nodes) == 0: - id = random.choice(eligible_active_nodes()) + id = random.choice(active_nodes) operations.append((DECOMMISSION, id)) decommission(id) else: op = random.choice(op_types) if op == DECOMMISSION: - id = random.choice(eligible_active_nodes()) + id = random.choice(active_nodes) operations.append((DECOMMISSION, id)) decommission(id) elif op == ADD: id = random.choice(decommissioned_nodes) operations.append((ADD, id)) add(id) - # topic operation - if len(topics) == 0: - op = ADD_TOPIC - else: - op = random.choice(tp_op_types) - - if op == ADD_TOPIC: - operations.append(( - ADD_TOPIC, - f"test-topic-{random.randint(0,2000)}-{round(time.time()*1000000)}", - random.choice(ALLOWED_REPLICATION), 3)) - else: - operations.append((DELETE_TOPIC, random.choice(topics))) return operations @@ -302,42 +281,9 @@ def has_new_replicas(): timeout_sec=NODE_OP_TIMEOUT, backoff_sec=2) - def is_topic_present(name): - kcl = KCL(self.redpanda) - lines = kcl.list_topics().splitlines() - self.redpanda.logger.debug( - f"checking if topic {name} is present in {lines}") - for l in lines: - if l.startswith(name): - return True - return False - - def create_topic(spec): - try: - DefaultClient(self.redpanda).create_topic(spec) - except Exception as e: - self.redpanda.logger.warn( - f"error creating topic {spec.name} - {e}") - try: - return is_topic_present(spec.name) - except Exception as e: - self.redpanda.logger.warn(f"error while listing topics - {e}") - return False - - def delete_topic(name): - try: - DefaultClient(self.redpanda).delete_topic(name) - except Exception as e: - self.redpanda.logger.warn(f"error deleting topic {name} - {e}") - try: - return not is_topic_present(name) - except Exception as e: - self.redpanda.logger.warn(f"error while listing topics - {e}") - return False - work = self.generate_random_workload(10, - skip_nodes=set(), available_nodes=self.active_nodes) + self.redpanda.logger.info(f"node operations to execute: {work}") for op in work: op_type = op[0] @@ -351,17 +297,6 @@ def delete_topic(name): idx = op[1] self.active_nodes.remove(idx) decommission(idx) - elif op_type == ADD_TOPIC: - spec = TopicSpec(name=op[1], - replication_factor=op[2], - partition_count=op[3]) - wait_until(lambda: create_topic(spec) == True, - timeout_sec=180, - backoff_sec=2) - elif op_type == DELETE_TOPIC: - wait_until(lambda: delete_topic(op[1]) == True, - timeout_sec=180, - backoff_sec=2) enable_failures = False admin_fuzz.wait(20, 180)