Skip to content

Commit

Permalink
Dev: behave: Add test case for schema change
Browse files Browse the repository at this point in the history
  • Loading branch information
liangxin1300 committed Feb 18, 2025
1 parent 913e771 commit 77281bc
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/features/configure_bugs.feature
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,16 @@ Feature: Functional test for configure sub level
And Try "crm configure show|grep -E "@vip.0|qwertyui""
Then Expected return code is "1"
And Show crm configure

@clean
Scenario: Setting schema
Given Cluster service is "stopped" on "hanode1"
And Cluster service is "stopped" on "hanode2"
When Run "crm cluster init -y" on "hanode1"
Then Cluster service is "started" on "hanode1"
When Run "crm cluster join -c hanode1 -y" on "hanode2"
Then Cluster service is "started" on "hanode2"
And Online nodes are "hanode1 hanode2"
Then Test schema change
When Try "crm configure schema xxx" on "hanode1"
Then Except "schema xxx is not supported" in stderr
17 changes: 17 additions & 0 deletions test/features/steps/step_implementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,3 +605,20 @@ def step_impl(context, nodes):
EOF''',
user='root',
)


@then('Test schema change')
def step_impl(context):
rc, schema, _ = ShellUtils().get_stdout_stderr("crm configure schema")
if rc != 0 or not schema:
return False
ver = re.search(r'pacemaker-(\d+\.\d+)', schema).group(1)
expected_ver = float(ver) - 0.1
expected_schema = f"pacemaker-{expected_ver:.1f}"
rc, _, _ = ShellUtils().get_stdout_stderr(f"crm configure schema {expected_schema}")
if rc != 0:
return False
rc, schema, _ = ShellUtils().get_stdout_stderr("crm configure schema")
if rc != 0 or not schema:
return False
assert schema == expected_schema

0 comments on commit 77281bc

Please sign in to comment.