Skip to content

Commit

Permalink
Dev: behave: Add functional test for previous changes
Browse files Browse the repository at this point in the history
  • Loading branch information
liangxin1300 committed Aug 11, 2021
1 parent 31c3d21 commit 058875f
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 2 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/crmsh-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,16 @@ jobs:
$DOCKER_SCRIPT resource before_install
$DOCKER_SCRIPT resource run
functional_test_operation:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v2
- name: functional test for operations
run: |
$DOCKER_SCRIPT operation before_install
$DOCKER_SCRIPT operation run
functional_test_configure_sublevel:
runs-on: ubuntu-latest
timeout-minutes: 20
Expand Down
3 changes: 2 additions & 1 deletion data-manifest
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ test/features/environment.py
test/features/geo_setup.feature
test/features/hb_report_bugs.feature
test/features/ocfs2.feature
test/features/operation_maintenance.feature
test/features/qdevice_options.feature
test/features/qdevice_setup_remove.feature
test/features/qdevice_usercase.feature
Expand Down Expand Up @@ -194,8 +195,8 @@ test/unittests/test_objset.py
test/unittests/test_ocfs2.py
test/unittests/test_parallax.py
test/unittests/test_parse.py
test/unittests/test_ratrace.py
test/unittests/test_qdevice.py
test/unittests/test_ratrace.py
test/unittests/test_report.py
test/unittests/test_sbd.py
test/unittests/test_scripts.py
Expand Down
57 changes: 57 additions & 0 deletions test/features/operation_maintenance.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
@operation
Feature: Test cluster/node/resources maintenance

Tag @clean means need to stop cluster service if the service is available

Background: Setup one node cluster and configure some resources
Given Cluster service is "stopped" on "hanode1"
Given 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"
When Run "crm configure primitive d Dummy op monitor interval=3s" on "hanode1"
Then Resource "d" type "Dummy" is "Started"

@clean
Scenario: Give error when start/stop resources while cluster in maintenance
When Run "crm maintenance on" on "hanode1"
And Try "crm resource stop d" on "hanode1"
Then Except "ERROR: resource.stop: Resource d is unmanaged" in stderr
Then Resource "d" type "Dummy" is "Started"
When Run "crm maintenance off" on "hanode1"
When Run "crm resource stop d" on "hanode1"
Then Resource "d" type "Dummy" is "Stopped"

@clean
Scenario: Give error when start/stop resources while all nodes in maintenance
When Run "crm node maintenance hanode1" on "hanode1"
When Run "crm node maintenance hanode2" on "hanode2"
And Try "crm resource stop d" on "hanode1"
Then Except "ERROR: resource.stop: Resource d is unmanaged" in stderr
Then Resource "d" type "Dummy" is "Started"
When Run "crm node ready hanode1" on "hanode1"
When Run "crm node ready hanode2" on "hanode2"
When Run "crm resource stop d" on "hanode1"
Then Resource "d" type "Dummy" is "Stopped"

@clean
Scenario: Give error when start/stop resources while node running this RA in maintenance
When Run "crm configure location loc1 d 100: hanode1" on "hanode1"
And Run "crm node maintenance hanode1" on "hanode1"
And Try "crm resource stop d" on "hanode1"
Then Except "ERROR: resource.stop: Resource d is unmanaged" in stderr
Then Resource "d" type "Dummy" is "Started"
When Run "crm node ready hanode1" on "hanode1"
When Run "crm resource stop d" on "hanode1"
Then Resource "d" type "Dummy" is "Stopped"

@clean
Scenario: Give error when start/stop resources while this RA in maintenance
When Run "crm resource maintenance d on" on "hanode1"
And Try "crm resource stop d" on "hanode1"
Then Except "ERROR: resource.stop: Resource d is unmanaged" in stderr
Then Resource "d" type "Dummy" is "Started"
When Run "crm resource maintenance d off" on "hanode1"
When Run "crm resource stop d" on "hanode1"
Then Resource "d" type "Dummy" is "Stopped"
2 changes: 1 addition & 1 deletion test/run-in-travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ case "$1" in
configure
make_install
exit $?;;
bootstrap|qdevice|hb_report|resource|geo|configure|constraints|ocfs2)
bootstrap|qdevice|hb_report|resource|geo|configure|constraints|ocfs2|operation)
functional_tests $1 $2
exit $?;;
*|original)
Expand Down

0 comments on commit 058875f

Please sign in to comment.