Skip to content

Commit

Permalink
test(negative): decouple stress operations from physical node operations
Browse files Browse the repository at this point in the history
Signed-off-by: Yang Chiu <[email protected]>
  • Loading branch information
yangchiu authored and khushboo-rancher committed Jan 30, 2024
1 parent 8bcdfa7 commit a2d12bc
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 34 deletions.
2 changes: 1 addition & 1 deletion e2e/keywords/common.resource
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Documentation Common keywords
Library ../libs/keywords/common_keywords.py
Library ../libs/keywords/node_keywords.py
Library ../libs/keywords/stress_keywords.py
Library ../libs/keywords/volume_keywords.py
Library ../libs/keywords/recurring_job_keywords.py
Library ../libs/keywords/workload_keywords.py
Expand Down
12 changes: 0 additions & 12 deletions e2e/keywords/node.resource
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,3 @@ Restart cluster
FOR ${statefulset} IN @{statefulset_list}
wait_for_workload_pod_stable ${statefulset}
END

Stress the CPU of all ${role} nodes
stress_node_cpu_by_role ${role}

Stress the CPU of all volume nodes
stress_node_cpu_by_volumes ${volume_list}

Stress the memory of all ${role} nodes
stress_node_memory_by_role ${role}

Stress the memory of all volume nodes
stress_node_memory_by_volumes ${volume_list}
17 changes: 17 additions & 0 deletions e2e/keywords/stress.resource
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
*** Settings ***
Documentation Stress Node Keywords
Library ../libs/keywords/stress_keywords.py

*** Keywords ***
Stress the CPU of all ${role} nodes
stress_node_cpu_by_role ${role}

Stress the CPU of all volume nodes
stress_node_cpu_by_volumes ${volume_list}

Stress the memory of all ${role} nodes
stress_node_memory_by_role ${role}

Stress the memory of all volume nodes
stress_node_memory_by_volumes ${volume_list}
19 changes: 0 additions & 19 deletions e2e/libs/keywords/node_keywords.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
from robot.libraries.BuiltIn import BuiltIn

from node import Node
from node import Stress
from node.utility import get_node_by_index
from node.utility import list_node_names_by_role
from node.utility import list_node_names_by_volumes

from utility.utility import wait_for_all_instance_manager_running

Expand All @@ -13,7 +10,6 @@ class node_keywords:

def __init__(self):
self.node = Node()
self.stress = Stress()

def reboot_volume_node(self, volume_name):
volume_keywords = BuiltIn().get_library_instance('volume_keywords')
Expand All @@ -40,18 +36,3 @@ def reboot_node_by_name(self, node_name, power_off_time_in_min=1):

def wait_for_all_instance_manager_running(self):
wait_for_all_instance_manager_running()

def cleanup_stress_helper(self):
self.stress.cleanup()

def stress_node_cpu_by_role(self, role):
self.stress.cpu(list_node_names_by_role(role))

def stress_node_cpu_by_volumes(self, volume_names):
self.stress.cpu(list_node_names_by_volumes(volume_names))

def stress_node_memory_by_role(self, role):
self.stress.memory(list_node_names_by_role(role))

def stress_node_memory_by_volumes(self, volume_names):
self.stress.memory(list_node_names_by_volumes(volume_names))
26 changes: 26 additions & 0 deletions e2e/libs/keywords/stress_keywords.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from robot.libraries.BuiltIn import BuiltIn

from node import Stress
from node.utility import list_node_names_by_role
from node.utility import list_node_names_by_volumes


class stress_keywords:

def __init__(self):
self.stress = Stress()

def cleanup_stress_helper(self):
self.stress.cleanup()

def stress_node_cpu_by_role(self, role):
self.stress.cpu(list_node_names_by_role(role))

def stress_node_cpu_by_volumes(self, volume_names):
self.stress.cpu(list_node_names_by_volumes(volume_names))

def stress_node_memory_by_role(self, role):
self.stress.memory(list_node_names_by_role(role))

def stress_node_memory_by_volumes(self, volume_names):
self.stress.memory(list_node_names_by_volumes(volume_names))
2 changes: 1 addition & 1 deletion e2e/tests/stress_cpu.robot
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
*** Settings ***
Documentation Negative Test Cases
Resource ../keywords/node.resource
Resource ../keywords/stress.resource
Resource ../keywords/volume.resource
Resource ../keywords/workload.resource
Resource ../keywords/common.resource
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/stress_memory.robot
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
*** Settings ***
Documentation Negative Test Cases
Resource ../keywords/node.resource
Resource ../keywords/stress.resource
Resource ../keywords/volume.resource
Resource ../keywords/workload.resource
Resource ../keywords/common.resource
Expand Down

0 comments on commit a2d12bc

Please sign in to comment.