Skip to content

Commit f95c34b

Browse files
committed
test(robot): add test case Test Volume Expansion During Volume Cloning
Signed-off-by: Yang Chiu <yang.chiu@suse.com>
1 parent b49b06e commit f95c34b

11 files changed

Lines changed: 102 additions & 10 deletions

e2e/keywords/persistentvolumeclaim.resource

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,12 @@ Assert persistentvolumeclaim ${claim_id} is using storageclass ${storageclass_na
6969
${claim_name} = generate_name_with_suffix claim ${claim_id}
7070
${current_storageclass} = get_pvc_storageclass_name ${claim_name}
7171
Should Be Equal ${current_storageclass} ${storageclass_name}
72+
73+
Expand persistentvolumeclaim ${claim_id} size to ${size}
74+
${claim_name} = generate_name_with_suffix claim ${claim_id}
75+
expand_persistentvolumeclaim_size_to ${claim_name} ${size}
76+
77+
Wait for volume of persistentvolumeclaim ${claim_id} size to be ${size}
78+
${claim_name} = generate_name_with_suffix claim ${claim_id}
79+
${volume_name} = get_volume_name_from_persistentvolumeclaim ${claim_name}
80+
wait_for_volume_expand_to_size ${volume_name} ${size}

e2e/libs/keywords/persistentvolumeclaim_keywords.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from utility.constant import LABEL_TEST
66
from utility.constant import LABEL_TEST_VALUE
77
from utility.utility import logging
8+
from utility.utility import convert_size_to_bytes
89

910
from volume.constant import MEBIBYTE
1011

@@ -31,11 +32,12 @@ def delete_persistentvolumeclaim(self, name):
3132
logging(f'Deleting persistentvolumeclaim {name}')
3233
return self.claim.delete(name)
3334

34-
def expand_persistentvolumeclaim_size_by_mib(self, claim_name, size_in_mib):
35-
size_in_byte = int(size_in_mib) * MEBIBYTE
35+
def expand_persistentvolumeclaim_size_to(self, claim_name, size):
36+
logging(f'Expanding persistentvolumeclaim {claim_name} to {size}')
37+
size_in_byte = convert_size_to_bytes(size)
3638
expanded_size = self.claim.expand(claim_name, size_in_byte)
3739

38-
logging(f'Expanding persistentvolumeclaim {claim_name} by {size_in_mib} MiB')
40+
logging(f'Expanded persistentvolumeclaim {claim_name} to {expanded_size}')
3941
self.claim.set_annotation(claim_name, ANNOT_EXPANDED_SIZE, str(expanded_size))
4042

4143
def get_claim_requested_size(self, claim_name):

e2e/libs/keywords/volume_keywords.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def list_volumes(self, dataEngine=None):
6565
return self.volume.list_names(dataEngine=dataEngine)
6666

6767
def wait_for_volume_expand_to_size(self, volume_name, size):
68-
logging(f'Waiting for volume {volume_name} expand to {size}')
68+
logging(f'Waiting for volume {volume_name} to expand to {size}')
6969
return self.volume.wait_for_volume_expand_to_size(volume_name, size)
7070

7171
def get_replica_node(self, volume_name):
@@ -302,8 +302,8 @@ def wait_for_volume_condition(self, volume_name, condition_name, condition_statu
302302
self.volume.wait_for_volume_condition(volume_name, condition_name, condition_status, reason)
303303

304304
def wait_for_volume_clone_status_completed(self, volume_name):
305-
logging(f'Waiting for volume {volume_name} clone status to be completed')
306-
self.volume.wait_for_volume_clone_status(volume_name, "completed")
305+
logging(f'Waiting for volume {volume_name} clone status to be copy-completed-awaiting-healthy')
306+
self.volume.wait_for_volume_clone_status(volume_name, "copy-completed-awaiting-healthy")
307307

308308
def wait_for_volume_migration_to_be_ready(self, volume_name):
309309
logging(f'Waiting for volume {volume_name} migration to be ready')

e2e/libs/persistentvolumeclaim/persistentvolumeclaim.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ def get_volume_name(self, claim_name):
121121
def expand(self, claim_name, size_in_byte, skip_retry=False):
122122
expanded_size = self.claim.expand(claim_name, size_in_byte, skip_retry=skip_retry)
123123
self.set_annotation(claim_name, ANNOT_EXPANDED_SIZE, str(expanded_size))
124+
return expanded_size
124125

125126
def expand_with_additional_bytes(self, claim_name, size_in_byte, skip_retry=False):
126127
pvc = self.claim.get(claim_name)

e2e/libs/volume/crd.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,12 @@ def wait_for_volume_expand_to_size(self, volume_name, expected_size):
504504
engine_operation = Engine()
505505
for i in range(self.retry_count):
506506
engine = engine_operation.get_engine(volume_name)
507-
engine_current_size = int(engine['status']['currentSize'])
507+
# there is no current size for a stopped engine
508+
if engine['status']['currentState'] == 'stopped':
509+
engine_current_size = int(engine['spec']['volumeSize'])
510+
else:
511+
engine_current_size = int(engine['status']['currentSize'])
512+
508513
if engine_current_size == engine_expected_size:
509514
break
510515

e2e/tests/negative/stress_cpu.robot

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ Stress Volume Node CPU When Volume Is Detaching and Attaching
4545
END
4646

4747
Stress Volume Node CPU When Volume Is Online Expanding
48+
[Tags] expansion
4849
Given Create storageclass longhorn-test with dataEngine=${DATA_ENGINE}
4950
And Create statefulset 0 using RWO volume with longhorn-test storageclass
5051
And Write 1024 MB data to file 0.txt in statefulset 0
@@ -59,6 +60,7 @@ Stress Volume Node CPU When Volume Is Online Expanding
5960
END
6061

6162
Stress Volume Node CPU When Volume Is Offline Expanding
63+
[Tags] expansion
6264
Given Create storageclass longhorn-test with dataEngine=${DATA_ENGINE}
6365
And Create statefulset 0 using RWO volume with longhorn-test storageclass
6466
And Write 1024 MB data to file 0.txt in statefulset 0

e2e/tests/negative/stress_filesystem.robot

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ Stress Volume Node Filesystem When Volume Is Detaching and Attaching
4545
END
4646

4747
Stress Volume Node Filesystem When Volume Is Online Expanding
48+
[Tags] expansion
4849
Given Create storageclass longhorn-test with dataEngine=${DATA_ENGINE}
4950
And Create statefulset 0 using RWO volume with longhorn-test storageclass
5051
And Write 1024 MB data to file data.txt in statefulset 0
@@ -58,6 +59,7 @@ Stress Volume Node Filesystem When Volume Is Online Expanding
5859
END
5960

6061
Stress Volume Node Filesystem When Volume Is Offline Expanding
62+
[Tags] expansion
6163
Given Create storageclass longhorn-test with dataEngine=${DATA_ENGINE}
6264
And Create statefulset 0 using RWO volume with longhorn-test storageclass
6365
And Write 1024 MB data to file data.txt in statefulset 0

e2e/tests/negative/stress_memory.robot

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ Stress Volume Node Memory When Volume Is Detaching and Attaching
4646
END
4747

4848
Stress Volume Node Memory When Volume Is Online Expanding
49+
[Tags] expansion
4950
Given Create storageclass longhorn-test with dataEngine=${DATA_ENGINE}
5051
And Create statefulset 0 using RWO volume with longhorn-test storageclass
5152
And Write 1024 MB data to file 0.txt in statefulset 0
@@ -60,6 +61,7 @@ Stress Volume Node Memory When Volume Is Online Expanding
6061
END
6162

6263
Stress Volume Node Memory When Volume Is Offline Expanding
64+
[Tags] expansion
6365
Given Create storageclass longhorn-test with dataEngine=${DATA_ENGINE}
6466
And Create statefulset 0 using RWO volume with longhorn-test storageclass
6567
And Write 1024 MB data to file 0.txt in statefulset 0

e2e/tests/negative/test_dr_volume.robot

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ Sync Up With Backup Target During DR Volume Activation
127127
Then Check pod 0 file version-info.txt has checksum d51dc42f616b67126fd2aa1e1f43385b
128128

129129
Test DR Volume Live Upgrade And Rebuild
130-
[Tags] manual negative dr-volume-live-upgrade-and-rebuild
130+
[Tags] manual negative dr-volume-live-upgrade-and-rebuild expansion upgrade
131131
[Documentation] - Test DR volume live upgrade and rebuild
132132
... Related Issue:
133133
... https://github.com/longhorn/longhorn/issues/1279
@@ -248,7 +248,7 @@ Test DR Volume Live Upgrade And Rebuild
248248
And Check pod 2 works
249249

250250
Test DR Volume Incremental Restore After Source Volume Expansion
251-
[Tags] manual negative dr-volume-expansion
251+
[Tags] manual negative dr-volume-expansion expansion
252252
[Documentation] - Test DR Volume Incremental Restore After Source Volume Expansion
253253
... Related Issue:
254254
... https://github.com/longhorn/longhorn/issues/11767

e2e/tests/regression/test_encrypted_volume.robot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Test Encrypted RWX Volume Basic
4848
RWX
4949

5050
Test Encrypted RWO Volume Online Expansion
51-
[Tags] rwo
51+
[Tags] rwo expansion
5252
Given Create crypto secret
5353
When Create storageclass longhorn-crypto with encrypted=true dataEngine=${DATA_ENGINE}
5454
And Create persistentvolumeclaim 0 volume_type=RWO sc_name=longhorn-crypto storage_size=50MiB

0 commit comments

Comments
 (0)