From b52d00ea2562d81fbda5a815018ed01d5889732c Mon Sep 17 00:00:00 2001 From: Chin-Ya Huang Date: Thu, 14 Nov 2024 14:34:03 +0800 Subject: [PATCH] chore(robot): cleanup Signed-off-by: Chin-Ya Huang --- e2e/libs/keywords/backing_image_keywords.py | 2 +- e2e/libs/keywords/backup_keywords.py | 1 + e2e/libs/keywords/backupstore_keywords.py | 5 +++-- e2e/libs/keywords/common_keywords.py | 1 + e2e/libs/keywords/engine_image_keywords.py | 2 +- e2e/libs/keywords/engine_keywords.py | 2 +- e2e/libs/keywords/host_keywords.py | 3 ++- e2e/libs/keywords/k8s_keywords.py | 9 +++++++-- e2e/libs/keywords/longhorn_deploy_keywords.py | 2 ++ e2e/libs/keywords/network_keywords.py | 2 +- e2e/libs/keywords/node_keywords.py | 2 ++ e2e/libs/keywords/persistentvolume_keywords.py | 1 + e2e/libs/keywords/replica_keywords.py | 1 + e2e/libs/keywords/setting_keywords.py | 1 + e2e/libs/keywords/sharemanager_keywords.py | 4 ++-- e2e/libs/keywords/statefulset_keywords.py | 1 - e2e/libs/keywords/storageclass_keywords.py | 1 + e2e/libs/keywords/workload_keywords.py | 2 +- 18 files changed, 29 insertions(+), 13 deletions(-) diff --git a/e2e/libs/keywords/backing_image_keywords.py b/e2e/libs/keywords/backing_image_keywords.py index 08927ee276..67bdf32856 100644 --- a/e2e/libs/keywords/backing_image_keywords.py +++ b/e2e/libs/keywords/backing_image_keywords.py @@ -23,7 +23,7 @@ def cleanup_backing_images(self): def delete_backing_image_manager(self, name): self.backing_image.delete_backing_image_manager(name) - + def wait_all_backing_image_managers_running(self): self.backing_image.wait_all_backing_image_managers_running() diff --git a/e2e/libs/keywords/backup_keywords.py b/e2e/libs/keywords/backup_keywords.py index c1cc0a8f0e..c586f432f1 100644 --- a/e2e/libs/keywords/backup_keywords.py +++ b/e2e/libs/keywords/backup_keywords.py @@ -1,4 +1,5 @@ from backup import Backup + from utility.utility import logging from utility.utility import get_backupstore diff --git a/e2e/libs/keywords/backupstore_keywords.py b/e2e/libs/keywords/backupstore_keywords.py index 3cec22c990..4f9a731bea 100644 --- a/e2e/libs/keywords/backupstore_keywords.py +++ b/e2e/libs/keywords/backupstore_keywords.py @@ -1,8 +1,9 @@ from backupstore import Nfs, S3 -from utility.utility import get_backupstore -from utility.utility import logging + import os +from utility.utility import get_backupstore + class backupstore_keywords: diff --git a/e2e/libs/keywords/common_keywords.py b/e2e/libs/keywords/common_keywords.py index 48c524eec3..1414875590 100644 --- a/e2e/libs/keywords/common_keywords.py +++ b/e2e/libs/keywords/common_keywords.py @@ -1,5 +1,6 @@ from node import Node from node_exec import NodeExec + from utility.utility import init_k8s_api_client from utility.utility import generate_name_with_suffix diff --git a/e2e/libs/keywords/engine_image_keywords.py b/e2e/libs/keywords/engine_image_keywords.py index dd84f05b01..e8dff8b3c4 100644 --- a/e2e/libs/keywords/engine_image_keywords.py +++ b/e2e/libs/keywords/engine_image_keywords.py @@ -1,5 +1,5 @@ from engine_image import EngineImage -from utility.utility import logging + class engine_image_keywords: diff --git a/e2e/libs/keywords/engine_keywords.py b/e2e/libs/keywords/engine_keywords.py index ebdd2425c5..c9eea58ebf 100644 --- a/e2e/libs/keywords/engine_keywords.py +++ b/e2e/libs/keywords/engine_keywords.py @@ -1,5 +1,5 @@ from engine import Engine -from utility.utility import logging + class engine_keywords: diff --git a/e2e/libs/keywords/host_keywords.py b/e2e/libs/keywords/host_keywords.py index b2a4fe64c2..99d6cc4a67 100644 --- a/e2e/libs/keywords/host_keywords.py +++ b/e2e/libs/keywords/host_keywords.py @@ -1,6 +1,7 @@ -import os from robot.libraries.BuiltIn import BuiltIn +import os + from host import Harvester, Aws from host.constant import NODE_REBOOT_DOWN_TIME_SECOND diff --git a/e2e/libs/keywords/k8s_keywords.py b/e2e/libs/keywords/k8s_keywords.py index 781abc4523..ad5f66b65f 100644 --- a/e2e/libs/keywords/k8s_keywords.py +++ b/e2e/libs/keywords/k8s_keywords.py @@ -1,5 +1,7 @@ -import asyncio from robot.libraries.BuiltIn import BuiltIn + +import asyncio + from k8s.k8s import restart_kubelet from k8s.k8s import delete_node from k8s.k8s import drain_node, force_drain_node @@ -10,9 +12,12 @@ from k8s.k8s import get_instance_manager_on_node from k8s.k8s import check_instance_manager_pdb_not_exist from k8s.k8s import wait_for_namespace_pods_running -from utility.utility import logging + from node import Node +from utility.utility import logging + + class k8s_keywords: async def restart_kubelet(self, node_name, downtime_in_sec): diff --git a/e2e/libs/keywords/longhorn_deploy_keywords.py b/e2e/libs/keywords/longhorn_deploy_keywords.py index ac170f4d5f..9043815788 100644 --- a/e2e/libs/keywords/longhorn_deploy_keywords.py +++ b/e2e/libs/keywords/longhorn_deploy_keywords.py @@ -1,4 +1,6 @@ from longhorn_deploy import LonghornDeploy + + class longhorn_deploy_keywords: def __init__(self): diff --git a/e2e/libs/keywords/network_keywords.py b/e2e/libs/keywords/network_keywords.py index 5b72b66e04..9566fb0708 100644 --- a/e2e/libs/keywords/network_keywords.py +++ b/e2e/libs/keywords/network_keywords.py @@ -44,6 +44,6 @@ def disconnect_node_network_without_waiting_completion(self, node_name, disconne def drop_pod_egress_traffic(self, pod_name, drop_time_in_sec): drop_pod_egress_traffic(pod_name, drop_time_in_sec) - + def wait_for_block_network_pod_completed(self, pod_name, status, namespace='default'): wait_for_pod_status(pod_name, status, namespace) diff --git a/e2e/libs/keywords/node_keywords.py b/e2e/libs/keywords/node_keywords.py index bd53dcfdf6..cb9a8dbaab 100644 --- a/e2e/libs/keywords/node_keywords.py +++ b/e2e/libs/keywords/node_keywords.py @@ -1,6 +1,8 @@ from node import Node + from utility.utility import logging + class node_keywords: def __init__(self): diff --git a/e2e/libs/keywords/persistentvolume_keywords.py b/e2e/libs/keywords/persistentvolume_keywords.py index 87a0ec569c..e160a281e6 100644 --- a/e2e/libs/keywords/persistentvolume_keywords.py +++ b/e2e/libs/keywords/persistentvolume_keywords.py @@ -1,4 +1,5 @@ from persistentvolume import PersistentVolume + from utility.utility import logging diff --git a/e2e/libs/keywords/replica_keywords.py b/e2e/libs/keywords/replica_keywords.py index 86454f4689..a9f0966c2f 100644 --- a/e2e/libs/keywords/replica_keywords.py +++ b/e2e/libs/keywords/replica_keywords.py @@ -1,5 +1,6 @@ from replica import Replica + class replica_keywords: def __init__(self): diff --git a/e2e/libs/keywords/setting_keywords.py b/e2e/libs/keywords/setting_keywords.py index 8ee4b551bb..a67ff8ada0 100644 --- a/e2e/libs/keywords/setting_keywords.py +++ b/e2e/libs/keywords/setting_keywords.py @@ -1,5 +1,6 @@ from setting import Setting + class setting_keywords: def __init__(self): diff --git a/e2e/libs/keywords/sharemanager_keywords.py b/e2e/libs/keywords/sharemanager_keywords.py index cafc00fbca..f9d501f349 100644 --- a/e2e/libs/keywords/sharemanager_keywords.py +++ b/e2e/libs/keywords/sharemanager_keywords.py @@ -51,9 +51,9 @@ def wait_for_sharemanagers_deleted(self, name=[]): def delete_sharemanager(self, name): return self.sharemanager.delete(name) - def delete_sharemanager_and_wait_for_recreation(self, name): + def delete_sharemanager_and_wait_for_recreation(self, name): sharemanager = self.sharemanager.get(name) - last_creation_time = sharemanager["metadata"]["creationTimestamp"] + last_creation_time = sharemanager["metadata"]["creationTimestamp"] self.sharemanager.delete(name) self.sharemanager.wait_for_restart(name, last_creation_time) diff --git a/e2e/libs/keywords/statefulset_keywords.py b/e2e/libs/keywords/statefulset_keywords.py index 49b0f5f59f..4baa61ab61 100644 --- a/e2e/libs/keywords/statefulset_keywords.py +++ b/e2e/libs/keywords/statefulset_keywords.py @@ -15,7 +15,6 @@ from workload.workload import get_workload_volume_name - class statefulset_keywords: def __init__(self): diff --git a/e2e/libs/keywords/storageclass_keywords.py b/e2e/libs/keywords/storageclass_keywords.py index eb2aedcb3c..bbffeaf1f8 100644 --- a/e2e/libs/keywords/storageclass_keywords.py +++ b/e2e/libs/keywords/storageclass_keywords.py @@ -1,6 +1,7 @@ from utility.utility import logging from storageclass import StorageClass + class storageclass_keywords: def __init__(self): diff --git a/e2e/libs/keywords/workload_keywords.py b/e2e/libs/keywords/workload_keywords.py index 1a28f5f9c5..7ebf6dabae 100644 --- a/e2e/libs/keywords/workload_keywords.py +++ b/e2e/libs/keywords/workload_keywords.py @@ -2,6 +2,7 @@ import asyncio from node import Node +from node.node import Node from persistentvolumeclaim import PersistentVolumeClaim @@ -29,7 +30,6 @@ from utility.constant import ANNOT_EXPANDED_SIZE from utility.constant import LABEL_LONGHORN_COMPONENT from utility.utility import logging -from node.node import Node from volume import Volume from volume.constant import MEBIBYTE