From 6b32517e377ee2cb56c99464064e9ebbe4ebabec Mon Sep 17 00:00:00 2001 From: Malgorzata Dutka Date: Tue, 23 Jul 2024 08:51:47 +0000 Subject: [PATCH] [ISSUE-1215]: Add const values Signed-off-by: Malgorzata Dutka --- tests/e2e-test-framework/framework/const.py | 1 + .../test_drive_replacement_multi_volumes.py | 8 ++++---- ...rive_replacement_multi_volumes_single_fail.py | 16 ++++++++-------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/tests/e2e-test-framework/framework/const.py b/tests/e2e-test-framework/framework/const.py index 2b6b5ebd0..e369bcfef 100644 --- a/tests/e2e-test-framework/framework/const.py +++ b/tests/e2e-test-framework/framework/const.py @@ -39,6 +39,7 @@ FAKE_ATTACH_PVC_ANNOTATION_KEY = "pv.attach.kubernetes.io/ignore-if-inaccessible" # annotation values +DRIVE_HEALTH_ANNOTATION = "BAD" VOLUME_RELEASE_DONE_VALUE = "done" FAKE_ATTACH_PVC_ANNOTATION_VALUE = "yes" diff --git a/tests/e2e-test-framework/tests/test_drive_replacement_multi_volumes.py b/tests/e2e-test-framework/tests/test_drive_replacement_multi_volumes.py index dd11005b8..37749624e 100644 --- a/tests/e2e-test-framework/tests/test_drive_replacement_multi_volumes.py +++ b/tests/e2e-test-framework/tests/test_drive_replacement_multi_volumes.py @@ -60,8 +60,8 @@ def test_5921_auto_drive_replacement_with_multiple_volumes_per_pod(self): self.utils.annotate_custom_resource( resource_name=drive_name, resource_type="drives", - annotation_key="health", - annotation_value="BAD" + annotation_key=const.DRIVE_HEALTH_ANNOTATION, + annotation_value=const.DRIVE_HEALTH_ANNOTATION ) logging.info(f"drive: {drive_name} was annotated with health=BAD") # 3. wait until drive health is BAD, status=ONLINE, usage=RELEASING. @@ -99,8 +99,8 @@ def test_5921_auto_drive_replacement_with_multiple_volumes_per_pod(self): self.utils.annotate_custom_resource( resource_name=volume_name, resource_type="volumes", - annotation_key="release", - annotation_value="done", + annotation_key=const.VOLUME_RELEASE_ANNOTATION, + annotation_value=const.VOLUME_RELEASE_DONE_VALUE, namespace=volume['metadata']['namespace'] ) logging.info(f"volume: {volume_name} was annotated with release=done") diff --git a/tests/e2e-test-framework/tests/test_drive_replacement_multi_volumes_single_fail.py b/tests/e2e-test-framework/tests/test_drive_replacement_multi_volumes_single_fail.py index 23a79f0b2..37b435746 100644 --- a/tests/e2e-test-framework/tests/test_drive_replacement_multi_volumes_single_fail.py +++ b/tests/e2e-test-framework/tests/test_drive_replacement_multi_volumes_single_fail.py @@ -55,15 +55,15 @@ def test_5955_auto_drive_replacement_with_multiple_volumes_per_pod_single_failur namespace=volume["metadata"]["namespace"]) drives.append(drive) failed_drive = drives[0] - health_drive = drives[1] + healthy_drive = drives[1] failed_volume = volumes[0] # 2. simulate drive failure. Annotate drive used by pod with health=BAD failed_drive_name = failed_drive["metadata"]["name"] self.utils.annotate_custom_resource( resource_name=failed_drive_name, resource_type="drives", - annotation_key="health", - annotation_value="BAD" + annotation_key=const.DRIVE_HEALTH_ANNOTATION, + annotation_value=const.DRIVE_HEALTH_ANNOTATION ) logging.info(f"drive: {failed_drive_name} was annotated with health=BAD") # 3. wait until drive health is BAD, status=ONLINE, usage=RELEASING. @@ -94,8 +94,8 @@ def test_5955_auto_drive_replacement_with_multiple_volumes_per_pod_single_failur self.utils.annotate_custom_resource( resource_name=failed_volume_name, resource_type="volumes", - annotation_key="release", - annotation_value="done", + annotation_key=const.VOLUME_RELEASE_ANNOTATION, + annotation_value=const.VOLUME_RELEASE_DONE_VALUE, namespace=volume['metadata']['namespace'] ) logging.info(f"volume: {failed_volume_name} was annotated with release=done") @@ -154,11 +154,11 @@ def test_5955_auto_drive_replacement_with_multiple_volumes_per_pod_single_failur cr_existence=False ), f"Drive CR {failed_drive_name} still exists" - health_drive_name = health_drive['metadata']['name'] + healthy_drive_name = healthy_drive['metadata']['name'] assert self.utils.check_drive_cr_exist_or_not( - drive_name=health_drive_name, + drive_name=healthy_drive_name, cr_existence=True, - ), f"Drive CR {health_drive_name} does not exist" + ), f"Drive CR {healthy_drive_name} does not exist" # 16. check for events DriveSuccessfullyRemoved in kubernetes events assert self.utils.event_in( resource_name=failed_drive_name,