From 058875fd8d79f4d05069b2f4dfca9ff093a997da Mon Sep 17 00:00:00 2001 From: liangxin1300 Date: Mon, 9 Aug 2021 14:31:33 +0800 Subject: [PATCH] Dev: behave: Add functional test for previous changes --- .github/workflows/crmsh-ci.yml | 10 ++++ data-manifest | 3 +- test/features/operation_maintenance.feature | 57 +++++++++++++++++++++ test/run-in-travis.sh | 2 +- 4 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 test/features/operation_maintenance.feature diff --git a/.github/workflows/crmsh-ci.yml b/.github/workflows/crmsh-ci.yml index 0d5727c1be..8e306fcdb6 100644 --- a/.github/workflows/crmsh-ci.yml +++ b/.github/workflows/crmsh-ci.yml @@ -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 diff --git a/data-manifest b/data-manifest index 61eeb85d0a..5203977309 100644 --- a/data-manifest +++ b/data-manifest @@ -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 @@ -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 diff --git a/test/features/operation_maintenance.feature b/test/features/operation_maintenance.feature new file mode 100644 index 0000000000..b8c42f1de2 --- /dev/null +++ b/test/features/operation_maintenance.feature @@ -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" diff --git a/test/run-in-travis.sh b/test/run-in-travis.sh index 849ae40e6f..352435b100 100755 --- a/test/run-in-travis.sh +++ b/test/run-in-travis.sh @@ -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)