diff --git a/e2e/libs/keywords/workload_keywords.py b/e2e/libs/keywords/workload_keywords.py index 41f2e0e5c..1d0369eab 100644 --- a/e2e/libs/keywords/workload_keywords.py +++ b/e2e/libs/keywords/workload_keywords.py @@ -158,13 +158,13 @@ def wait_for_workload_volume_detached(self, workload_name): logging(f'Waiting for {workload_name} volume {volume_name} to be detached') self.volume.wait_for_volume_detached(volume_name) - def expand_workload_claim_size(self, workload_name, size_in_byte, claim_index=0): + def expand_workload_claim_size(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} from {current_size_byte} to {size_in_byte}') - self.persistentvolumeclaim.expand(claim_name, size_in_byte) + self.persistentvolumeclaim.expand(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) diff --git a/e2e/libs/persistentvolumeclaim/crd.py b/e2e/libs/persistentvolumeclaim/crd.py index 2bd63d7fb..06ba50ee0 100644 --- a/e2e/libs/persistentvolumeclaim/crd.py +++ b/e2e/libs/persistentvolumeclaim/crd.py @@ -84,8 +84,9 @@ def get_volume_name(self, claim_name, claim_namespace="default"): claim = self.get(claim_name, claim_namespace) return claim.spec.volume_name - def expand(self, claim_name, size, namespace="default"): - for i in range(self.retry_count): + 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})") try: self.core_v1_api.patch_namespaced_persistent_volume_claim( diff --git a/e2e/libs/persistentvolumeclaim/persistentvolumeclaim.py b/e2e/libs/persistentvolumeclaim/persistentvolumeclaim.py index 5822770c2..ae222c4a3 100644 --- a/e2e/libs/persistentvolumeclaim/persistentvolumeclaim.py +++ b/e2e/libs/persistentvolumeclaim/persistentvolumeclaim.py @@ -101,11 +101,11 @@ def get_annotation_value(self, claim_name, annotation_key): def get_volume_name(self, claim_name): return self.claim.get_volume_name(claim_name) - def expand(self, claim_name, size_in_byte): + def expand(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) + expanded_size = self.claim.expand(claim_name, target_size, skip_retry=skip_retry) self.set_annotation(claim_name, ANNOT_EXPANDED_SIZE, str(expanded_size))