Skip to content

Commit

Permalink
test(negative): stress volume node memory while replica rebuilding
Browse files Browse the repository at this point in the history
ref: 6705

Signed-off-by: Chin-Ya Huang <[email protected]>
  • Loading branch information
c3y1huang committed Oct 25, 2023
1 parent 2077f14 commit ac0f6ca
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 0 deletions.
3 changes: 3 additions & 0 deletions e2e/keywords/node.resource
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,6 @@ Restart cluster

During replica rebuilding, stress volume node cpu
stress_node_cpu_by_volume ${volume_name}

During replica rebuilding, stress volume node memory
stress_node_memory_by_volume ${volume_name}
5 changes: 5 additions & 0 deletions e2e/libs/keywords/node_keywords.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,8 @@ def stress_node_cpu_by_volume(self, volume_name):
volume_keywords = BuiltIn().get_library_instance('volume_keywords')
volume_node = volume_keywords.get_volume_node(volume_name)
self.stress.cpu([volume_node])

def stress_node_memory_by_volume(self, volume_name):
volume_keywords = BuiltIn().get_library_instance('volume_keywords')
volume_node = volume_keywords.get_volume_node(volume_name)
self.stress.memory([volume_node])
18 changes: 18 additions & 0 deletions e2e/libs/node/stress.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
from workload.pod import IMAGE_LITMUX

NODE_CPU_LOAD_PERCENTAGE = 100
NODE_MEM_LOAD_PERCENTAGE = 100
NODE_MEM_VM_WORKERS = 1
NODE_STRESS_TIMEOUT_SECOND = 300

LABEL_STRESS_HELPER = "longhorn-stress-helper"
Expand All @@ -37,3 +39,19 @@ def cpu(self, node_names):
pod_name = manifest['metadata']['name']
logging(f"Creating cpu stress pod {pod_name} on {node_name}")
create_pod(manifest, is_wait_for_pod_running=True)

def memory(self, node_names):
for node_name in node_names:
manifest = new_pod_manifest(
image=IMAGE_LITMUX,
command=["stress-ng"],
args=['--vm', str(NODE_MEM_VM_WORKERS),
'--vm-bytes', f"{NODE_MEM_LOAD_PERCENTAGE}%",
'--timeout', str(NODE_STRESS_TIMEOUT_SECOND)],
node_name=node_name,
labels={'app': LABEL_STRESS_HELPER}
)

pod_name = manifest['metadata']['name']
logging(f"Creating memory stress pod {pod_name} on {node_name}")
create_pod(manifest, is_wait_for_pod_running=True)
12 changes: 12 additions & 0 deletions e2e/tests/replica_rebuilding.robot
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,15 @@ Stress Volume Node CPU While Replica Rebuilding
Then Wait until replica on volume node rebuilt
And Check data is intact
END

Stress Volume Node Memory While Replica Rebuilding
Given Create a volume with 5 GB and 3 replicas
And Write data to the volume

FOR ${i} IN RANGE ${LOOP_COUNT}
When Delete replica on volume node to trigger replica rebuilding
And During replica rebuilding, stress volume node memory

Then Wait until replica on volume node rebuilt
And Check data is intact
END

0 comments on commit ac0f6ca

Please sign in to comment.