Skip to content

Commit 794caa1

Browse files
committed
Dev: behave: Adjust functional tests to replace /var/lib/heartbeat
Add 'Check passwordless for hacluster between <nodelist> <successfully|failed>' step to test if ssh failed after remove ssh key under /var/lib/pacemaker
1 parent 117b1a8 commit 794caa1

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

test/features/bootstrap_init_join_remove.feature

+9-7
Original file line numberDiff line numberDiff line change
@@ -154,33 +154,35 @@ Feature: crmsh bootstrap process - init, join and remove
154154

155155
Scenario: Check hacluster's passwordless configuration on 2 nodes
156156
Then Check user shell for hacluster between "hanode1 hanode2"
157-
Then Check passwordless for hacluster between "hanode1 hanode2"
157+
Then Check passwordless for hacluster between "hanode1 hanode2" "successfully"
158158

159159
Scenario: Check hacluster's passwordless configuration in old cluster, 2 nodes
160160
When Run "crm cluster stop --all" on "hanode1"
161161
Then Cluster service is "stopped" on "hanode1"
162162
And Cluster service is "stopped" on "hanode2"
163163
When Run "crm cluster init -y" on "hanode1"
164164
Then Cluster service is "started" on "hanode1"
165-
When Run "rm -rf /var/lib/heartbeat/cores/hacluster/.ssh" on "hanode1"
165+
When Run "rm -rf /var/lib/pacemaker/.ssh" on "hanode1"
166+
Then Check passwordless for hacluster between "hanode1 hanode2" "failed"
166167
When Run "crm cluster join -c hanode1 -y" on "hanode2"
167168
Then Cluster service is "started" on "hanode2"
168169
And Online nodes are "hanode1 hanode2"
169-
And Check passwordless for hacluster between "hanode1 hanode2"
170+
And Check passwordless for hacluster between "hanode1 hanode2" "successfully"
170171

171172
Scenario: Check hacluster's passwordless configuration on 3 nodes
172173
Given Cluster service is "stopped" on "hanode3"
173174
When Run "crm cluster join -c hanode1 -y" on "hanode3"
174175
Then Cluster service is "started" on "hanode3"
175176
And Online nodes are "hanode1 hanode2 hanode3"
176177
And Check user shell for hacluster between "hanode1 hanode2 hanode3"
177-
And Check passwordless for hacluster between "hanode1 hanode2 hanode3"
178+
And Check passwordless for hacluster between "hanode1 hanode2 hanode3" "successfully"
178179

179180
Scenario: Check hacluster's passwordless configuration in old cluster, 3 nodes
180181
Given Cluster service is "stopped" on "hanode3"
181-
When Run "rm -rf /var/lib/heartbeat/cores/hacluster/.ssh" on "hanode1"
182-
And Run "rm -rf /var/lib/heartbeat/cores/hacluster/.ssh" on "hanode2"
182+
When Run "rm -rf /var/lib/pacemaker/.ssh" on "hanode1"
183+
And Run "rm -rf /var/lib/pacemaker/.ssh" on "hanode2"
184+
Then Check passwordless for hacluster between "hanode1 hanode2 hanode3" "failed"
183185
When Run "crm cluster join -c hanode1 -y" on "hanode3"
184186
Then Cluster service is "started" on "hanode3"
185187
And Online nodes are "hanode1 hanode2 hanode3"
186-
And Check passwordless for hacluster between "hanode1 hanode2 hanode3"
188+
And Check passwordless for hacluster between "hanode1 hanode2 hanode3" "successfully"

test/features/steps/step_implementation.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -554,8 +554,9 @@ def step_impl(context, count, node):
554554
index += 1
555555
return False
556556

557-
@then('Check passwordless for hacluster between "{nodelist}"')
558-
def step_impl(context, nodelist):
557+
@then('Check passwordless for hacluster between "{nodelist}" "{result}"')
558+
def step_impl(context, nodelist, result):
559+
assert result in ("successfully", "failed")
559560
if userdir.getuser() != 'root' or userdir.get_sudoer():
560561
return True
561562
failed = False
@@ -570,7 +571,10 @@ def step_impl(context, nodelist):
570571
if rc != 0:
571572
failed = True
572573
context.logger.error(f"There is no passwordless configured from {nodes[i]} to {nodes[j]} under 'hacluster'")
573-
assert not failed
574+
if result == "successfully":
575+
assert not failed
576+
else:
577+
assert failed
574578

575579

576580
@then('Check user shell for hacluster between "{nodelist}"')

0 commit comments

Comments
 (0)