Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(robot): add block disk back to previously deleted node for v2 test cases #2190

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions e2e/keywords/k8s.resource
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ Delete volume of ${workload_kind} ${workload_id} replica node

Add deleted node back
reboot_node_by_name ${deleted_node}
${host_provider}= Get Environment Variable HOST_PROVIDER
${disk_path}= Set Variable If "${host_provider}" == "harvester" /dev/vdc /dev/xvdh
add_disk block-disk ${deleted_node} block ${disk_path}

Force drain volume of ${workload_kind} ${workload_id} volume node
${workload_name} = generate_name_with_suffix ${workload_kind} ${workload_id}
Expand Down
17 changes: 13 additions & 4 deletions e2e/libs/node/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,19 @@ def wait_for_disk_update(self, node_name, disk_num):
assert len(node.disks) == disk_num, f"Waiting for node {node_name} disk updated to {disk_num} failed: {disks}"

def add_disk(self, node_name, disk):
node = get_longhorn_client().by_id_node(node_name)
disks = node.disks
disks.update(disk)
self.update_disks(node_name, disks)
added = False
for i in range(self.retry_count):
try:
node = get_longhorn_client().by_id_node(node_name)
disks = node.disks
disks.update(disk)
self.update_disks(node_name, disks)
added = True
break
except Exception as e:
logging(f"Adding disk {disk} to node {node_name} error: {e}")
time.sleep(self.retry_interval)
assert added, f"Adding disk {disk} to node {node_name} failed"

def reset_disks(self, node_name):
node = get_longhorn_client().by_id_node(node_name)
Expand Down
Loading