Skip to content

Commit

Permalink
refactor(robot): get volume instance manager
Browse files Browse the repository at this point in the history
Signed-off-by: Chin-Ya Huang <[email protected]>
  • Loading branch information
c3y1huang committed Dec 17, 2024
1 parent 361a7ca commit cf52462
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
10 changes: 4 additions & 6 deletions e2e/keywords/longhorn.resource
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,14 @@ Install Longhorn

Delete instance-manager of volume ${volume_id}
${volume_name} = generate_name_with_suffix volume ${volume_id}
${node_name} = get_volume_node ${volume_name}
${pod_name} = get_instance_manager_on_node ${node_name}
delete_pod ${pod_name} longhorn-system
${instance_manager} = get_volume_instance_manager ${volume_name}
delete_pod ${instance_manager} longhorn-system

Delete instance-manager of deployment ${deployment_id} volume
${deployment_name} = generate_name_with_suffix deployment ${deployment_id}
${volume_name} = get_workload_volume_name ${deployment_name}
${node_name} = get_volume_node ${volume_name}
${pod_name} = get_instance_manager_on_node ${node_name}
delete_pod ${pod_name} longhorn-system
${instance_manager} = get_volume_instance_manager ${volume_name}
delete_pod ${instance_manager} longhorn-system

Wait for Longhorn components all running
wait_for_namespace_pods_running longhorn-system
Expand Down
6 changes: 6 additions & 0 deletions e2e/libs/keywords/volume_keywords.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from utility.utility import get_retry_count_and_interval

from volume import Volume
from volume.rest import Rest as VolumeRest


class volume_keywords:
Expand Down Expand Up @@ -70,6 +71,11 @@ def get_replica_node(self, volume_name):
def get_volume_node(self, volume_name):
return self.get_node_id_by_replica_locality(volume_name, "volume node")

def get_volume_instance_manager(self, volume_name):
volume = VolumeRest().get(volume_name)
assert len(volume['controllers']) == 1, f"Expect only one controller for volume {volume_name}; Got controllers: {volume['controllers']}"
return volume['controllers'][0]['instanceManagerName']

def get_node_id_by_replica_locality(self, volume_name, replica_locality):
return self.get_node_ids_by_replica_locality(volume_name, replica_locality)[0]

Expand Down

0 comments on commit cf52462

Please sign in to comment.