@@ -23,7 +23,14 @@ class TestDbHDBOperations(RolesTestingBaseDB):
2323 """
2424
2525 @pytest .fixture (
26- params = ["primary-node-crash" , "primary-node-kill" , "primary-echo-b" , "primary-crash-index" ]
26+ params = [
27+ "primary-node-crash" ,
28+ "primary-node-kill" ,
29+ "primary-echo-b" ,
30+ "primary-crash-index" ,
31+ "sbd-fencing" ,
32+ "fs-freeze" ,
33+ ]
2734 )
2835 def task_type (self , request ):
2936 """
@@ -64,6 +71,19 @@ def task_type(self, request):
6471 "command_type" : "killall" ,
6572 "validate_task" : "Test Execution: Validate HANA DB cluster status" ,
6673 }
74+ elif task_name == "sbd-fencing" :
75+ return {
76+ "task_name" : task_name ,
77+ "command_task" : "Test Execution: Kill the inquisitor process" ,
78+ "command_type" : "kill" ,
79+ "validate_task" : "Test Execution: Validate HANA DB cluster status 2" ,
80+ }
81+ elif task_name == "fs-freeze" :
82+ return {
83+ "task_name" : task_name ,
84+ "validate_task" : "Test Execution: Validate HANA DB cluster status 2" ,
85+ "command_task" : "dummy (no command)" ,
86+ }
6787
6888 @pytest .fixture
6989 def test_environment (self , ansible_inventory , task_type ):
@@ -82,23 +102,33 @@ def test_environment(self, ansible_inventory, task_type):
82102 if os .path .exists (task_counter_file ):
83103 os .remove (task_counter_file )
84104
105+ module_names = [
106+ "project/library/get_cluster_status_db" ,
107+ "project/library/log_parser" ,
108+ "project/library/send_telemetry_data" ,
109+ "project/library/location_constraints" ,
110+ "project/library/check_indexserver" ,
111+ "project/library/filesystem_freeze" ,
112+ "bin/crm_resource" ,
113+ "bin/crm" ,
114+ "bin/echo" ,
115+ "bin/killall" ,
116+ ]
117+
118+ if task_type ["task_name" ] == "sbd-fencing" :
119+ module_names .extend (["bin/pgrep" , "bin/kill" , "bin/head" ])
120+
85121 temp_dir = self .setup_test_environment (
86122 role_type = "ha_db_hana" ,
87123 ansible_inventory = ansible_inventory ,
88124 task_name = task_type ["task_name" ],
89125 task_description = f"The { task_type ['task_name' ]} test validates failover scenarios" ,
90- module_names = [
91- "project/library/get_cluster_status_db" ,
92- "project/library/log_parser" ,
93- "project/library/send_telemetry_data" ,
94- "project/library/location_constraints" ,
95- "project/library/check_indexserver" ,
96- "bin/crm_resource" ,
97- "bin/crm" ,
98- "bin/echo" ,
99- "bin/killall" ,
100- ],
101- extra_vars_override = {"node_tier" : "hana" },
126+ module_names = module_names ,
127+ extra_vars_override = {
128+ "node_tier" : "hana" ,
129+ "NFS_provider" : "ANF" ,
130+ "database_cluster_type" : "ISCSI" ,
131+ },
102132 )
103133
104134 os .makedirs (f"{ temp_dir } /bin" , exist_ok = True )
@@ -119,7 +149,7 @@ def test_environment(self, ansible_inventory, task_type):
119149 self .file_operations (
120150 operation = "write" ,
121151 file_path = f"{ temp_dir } /project/roles/ha_db_hana/tasks/{ task_type ['task_name' ]} .yml" ,
122- content = playbook_content .replace (
152+ content = playbook_content .replace ("set -o pipefail \n " , "" ). replace (
123153 "/usr/sap/{{ db_sid | upper }}/HDB{{ db_instance_number }}/" , ""
124154 ),
125155 )
@@ -170,8 +200,8 @@ def test_functional_db_primary_node_success(
170200 task = event .get ("event_data" , {}).get ("task" )
171201 task_result = event .get ("event_data" , {}).get ("res" )
172202
173- if task and task_type [ "command_task" ] in task :
174- if task_type ["command_type" ] == "echo b" :
203+ if task and task_type . get ( "command_task" ) in task :
204+ if task_type ["command_type" ] == "echo b" or task_type [ "command_type" ] == "kill" :
175205 assert task_result .get ("changed" ) is True
176206 else :
177207 assert task_result .get ("rc" ) == 0
0 commit comments