diff --git a/e2e/keywords/workload.resource b/e2e/keywords/workload.resource index 1c4eef61b..44fc7be0f 100644 --- a/e2e/keywords/workload.resource +++ b/e2e/keywords/workload.resource @@ -233,12 +233,18 @@ Check volume of ${workload_kind} ${workload_id} replica on node ${node_id} disk ${replicas} = get_replicas volume_name=${volume_name} node_name=${node_name} disk_uuid=${disk_uuid} Should Be True len(${replicas}) > 0 -Expand ${workload_kind} ${workload_id} volume by ${size} +Expand ${workload_kind} ${workload_id} volume to ${size} ${workload_name} = generate_name_with_suffix ${workload_kind} ${workload_id} ${new_size} = convert_size_to_bytes ${size} expand_workload_claim_size ${workload_name} ${new_size} +Expand ${workload_kind} ${workload_id} volume with additional ${size} + ${workload_name} = generate_name_with_suffix ${workload_kind} ${workload_id} + ${new_size} = convert_size_to_bytes ${size} + + expand_workload_claim_size_with_additional_bytes ${workload_name} ${new_size} + Expand ${workload_kind} ${workload_id} volume more than storage maximum size should fail ${workload_name} = generate_name_with_suffix ${workload_kind} ${workload_id} ${volume_name} = get_workload_volume_name ${workload_name} diff --git a/e2e/libs/keywords/workload_keywords.py b/e2e/libs/keywords/workload_keywords.py index 1d0369eab..1d7aae58f 100644 --- a/e2e/libs/keywords/workload_keywords.py +++ b/e2e/libs/keywords/workload_keywords.py @@ -166,6 +166,14 @@ def expand_workload_claim_size(self, workload_name, size_in_byte, claim_index=0, logging(f'Expanding {workload_name} persistentvolumeclaim {claim_name} from {current_size_byte} to {size_in_byte}') self.persistentvolumeclaim.expand(claim_name, size_in_byte, skip_retry=skip_retry) + def expand_workload_claim_size_with_additional_bytes(self, workload_name, size_in_byte, claim_index=0, skip_retry=False): + claim_name = get_workload_persistent_volume_claim_name(workload_name, index=claim_index) + current_size = self.persistentvolumeclaim.get(claim_name).spec.resources.requests['storage'] + current_size_byte = convert_size_to_bytes(current_size) + + logging(f'Expanding {workload_name} persistentvolumeclaim {claim_name} current size {current_size_byte} with additional {size_in_byte}') + self.persistentvolumeclaim.expand_with_additional_bytes(claim_name, size_in_byte, skip_retry=skip_retry) + def wait_for_workload_claim_size_expanded(self, workload_name, claim_index=0): claim_name = get_workload_persistent_volume_claim_name(workload_name, index=claim_index) expanded_size = self.persistentvolumeclaim.get_annotation_value(claim_name, ANNOT_EXPANDED_SIZE) diff --git a/e2e/libs/persistentvolumeclaim/crd.py b/e2e/libs/persistentvolumeclaim/crd.py index 06ba50ee0..688ca42f3 100644 --- a/e2e/libs/persistentvolumeclaim/crd.py +++ b/e2e/libs/persistentvolumeclaim/crd.py @@ -87,7 +87,7 @@ def get_volume_name(self, claim_name, claim_namespace="default"): def expand(self, claim_name, size, namespace="default", skip_retry=False): retry_count = 1 if skip_retry else self.retry_count for i in range(retry_count): - logging(f"Trying to expand pvc {claim_name} to size {size} ... ({i})") + logging(f"Trying to expand PVC {claim_name} to size {size} ... ({i})") try: self.core_v1_api.patch_namespaced_persistent_volume_claim( name=claim_name, diff --git a/e2e/libs/persistentvolumeclaim/persistentvolumeclaim.py b/e2e/libs/persistentvolumeclaim/persistentvolumeclaim.py index ae222c4a3..71d32afff 100644 --- a/e2e/libs/persistentvolumeclaim/persistentvolumeclaim.py +++ b/e2e/libs/persistentvolumeclaim/persistentvolumeclaim.py @@ -102,10 +102,13 @@ def get_volume_name(self, claim_name): return self.claim.get_volume_name(claim_name) def expand(self, claim_name, size_in_byte, skip_retry=False): + expanded_size = self.claim.expand(claim_name, size_in_byte, skip_retry=skip_retry) + self.set_annotation(claim_name, ANNOT_EXPANDED_SIZE, str(expanded_size)) + + def expand_with_additional_bytes(self, claim_name, size_in_byte, skip_retry=False): pvc = self.claim.get(claim_name) current_size = int(pvc.spec.resources.requests['storage']) target_size = current_size + size_in_byte - logging(f"Expanding PVC {claim_name} from {current_size} to {target_size}") expanded_size = self.claim.expand(claim_name, target_size, skip_retry=skip_retry) self.set_annotation(claim_name, ANNOT_EXPANDED_SIZE, str(expanded_size)) diff --git a/e2e/tests/negative/stress_cpu.robot b/e2e/tests/negative/stress_cpu.robot index 68047dc40..c74cc4fbc 100644 --- a/e2e/tests/negative/stress_cpu.robot +++ b/e2e/tests/negative/stress_cpu.robot @@ -50,7 +50,7 @@ Stress Volume Node CPU When Volume Is Online Expanding FOR ${i} IN RANGE ${LOOP_COUNT} And Stress CPU of volume nodes - When Expand statefulset 0 volume by 100 MiB + When Expand statefulset 0 volume with additional 100 MiB Then Wait for statefulset 0 volume size expanded And Check statefulset 0 data in file 0.txt is intact @@ -64,7 +64,7 @@ Stress Volume Node CPU When Volume Is Offline Expanding And Scale down statefulset 0 to detach volume And Stress CPU of all worker nodes - When Expand statefulset 0 volume by 100 MiB + When Expand statefulset 0 volume with additional 100 MiB Then Wait for statefulset 0 volume size expanded And Wait for statefulset 0 volume detached diff --git a/e2e/tests/negative/stress_filesystem.robot b/e2e/tests/negative/stress_filesystem.robot index 094aa6bf3..a2d39c9f8 100644 --- a/e2e/tests/negative/stress_filesystem.robot +++ b/e2e/tests/negative/stress_filesystem.robot @@ -49,7 +49,7 @@ Stress Volume Node Filesystem When Volume Is Online Expanding And Stress filesystem of statefulset 0 volume node FOR ${i} IN RANGE ${LOOP_COUNT} - When Expand statefulset 0 volume by 100 MiB + When Expand statefulset 0 volume with additional 100 MiB Then Wait for statefulset 0 volume size expanded And Check statefulset 0 data in file data.txt is intact @@ -63,7 +63,7 @@ Stress Volume Node Filesystem When Volume Is Offline Expanding FOR ${i} IN RANGE ${LOOP_COUNT} And Scale down statefulset 0 to detach volume - When Expand statefulset 0 volume by 100 MiB + When Expand statefulset 0 volume with additional 100 MiB Then Wait for statefulset 0 volume size expanded And Wait for statefulset 0 volume detached And Scale up statefulset 0 to attach volume diff --git a/e2e/tests/negative/stress_memory.robot b/e2e/tests/negative/stress_memory.robot index f566610d7..50c871fb3 100644 --- a/e2e/tests/negative/stress_memory.robot +++ b/e2e/tests/negative/stress_memory.robot @@ -51,7 +51,7 @@ Stress Volume Node Memory When Volume Is Online Expanding FOR ${i} IN RANGE ${LOOP_COUNT} And Stress memory of volume nodes - When Expand statefulset 0 volume by 100 MiB + When Expand statefulset 0 volume with additional 100 MiB Then Wait for statefulset 0 volume size expanded And Check statefulset 0 data in file 0.txt is intact @@ -65,7 +65,7 @@ Stress Volume Node Memory When Volume Is Offline Expanding And Scale down statefulset 0 to detach volume And Stress memory of all worker nodes - When Expand statefulset 0 volume by 100 MiB + When Expand statefulset 0 volume with additional 100 MiB Then Wait for statefulset 0 volume size expanded And Wait for statefulset 0 volume detached diff --git a/e2e/tests/regression/test_persistentvolumeclaim.robot b/e2e/tests/regression/test_persistentvolumeclaim.robot index a79ee437a..f296a3394 100644 --- a/e2e/tests/regression/test_persistentvolumeclaim.robot +++ b/e2e/tests/regression/test_persistentvolumeclaim.robot @@ -37,7 +37,7 @@ Test persistentvolumeclaim expand more than storage maximum size should fail And Assert persistentvolumeclaim 0 requested size remains 2GiB for at least 5 seconds And Check deployment 0 data in file data.txt is intact - When Expand deployment 0 volume by 1 GiB + When Expand deployment 0 volume to 3 GiB Then Assert persistentvolumeclaim 0 requested size remains 3GiB for at least 5 seconds And Assert volume size of deployment 0 remains 3GiB for at least 5 seconds And Check deployment 0 data in file data.txt is intact