From 035aeecfb0c5d5524fac258ca41b17e37e86d297 Mon Sep 17 00:00:00 2001 From: nicholasyang Date: Thu, 19 Sep 2024 16:31:38 +0800 Subject: [PATCH] Dev: behave: add functional tests for previous changes --- .github/workflows/crmsh-ci.yml | 16 ++++++++++++++++ codecov.yml | 4 ++-- data-manifest | 1 + test/features/healthcheck.feature | 30 ++++++++++++++++++++++++++++++ 4 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 test/features/healthcheck.feature diff --git a/.github/workflows/crmsh-ci.yml b/.github/workflows/crmsh-ci.yml index e4a9fda24..fa10187d9 100644 --- a/.github/workflows/crmsh-ci.yml +++ b/.github/workflows/crmsh-ci.yml @@ -389,6 +389,22 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} flags: integration + functional_test_healthcheck: + runs-on: ubuntu-24.04 + timeout-minutes: 40 + steps: + - uses: actions/checkout@v4 + - name: functional test for healthcheck + run: | + echo '{ "exec-opts": ["native.cgroupdriver=systemd"] }' | sudo tee /etc/docker/daemon.json + sudo systemctl restart docker.service + index=`$GET_INDEX_OF healthcheck` + $DOCKER_SCRIPT $index && $DOCKER_SCRIPT -d && $DOCKER_SCRIPT $index -u + - uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + flags: integration + functional_test_cluster_api: runs-on: ubuntu-24.04 timeout-minutes: 40 diff --git a/codecov.yml b/codecov.yml index 8810859ee..47000a652 100644 --- a/codecov.yml +++ b/codecov.yml @@ -8,7 +8,7 @@ coverage: threshold: 0.35% codecov: notify: - after_n_builds: 27 + after_n_builds: 28 comment: - after_n_builds: 27 + after_n_builds: 28 layout: "condensed_header, flags, files, condensed_footer" diff --git a/data-manifest b/data-manifest index 8ba105dbf..88aa8fee0 100644 --- a/data-manifest +++ b/data-manifest @@ -81,6 +81,7 @@ test/features/crm_report_bugs.feature test/features/crm_report_normal.feature test/features/environment.py test/features/geo_setup.feature +test/features/healthcheck.feature test/features/ocfs2.feature test/features/qdevice_options.feature test/features/qdevice_setup_remove.feature diff --git a/test/features/healthcheck.feature b/test/features/healthcheck.feature new file mode 100644 index 000000000..d3508297c --- /dev/null +++ b/test/features/healthcheck.feature @@ -0,0 +1,30 @@ +@healthcheck +Feature: healthcheck detect and fix problems in a crmsh deployment + + Tag @clean means need to stop cluster service if the service is available + Need nodes: hanode1 hanode2 hanode3 + + Background: Setup a two nodes cluster + Given Cluster service is "stopped" on "hanode1" + And Cluster service is "stopped" on "hanode2" + And Cluster service is "stopped" on "hanode3" + When Run "crm cluster init -y" on "hanode1" + Then Cluster service is "started" on "hanode1" + And Show cluster status 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" + And Show cluster status on "hanode1" + + @clean + Scenario: An upgrade_seq file in ~hacluster/crmsh/ will be migrated to /var/lib/crmsh (bsc#1213050) + When Run "rm -rf ~hacluster/.ssh" on "hanode1" + And Try "crm cluster health hawk2" on "hanode1" + Then Expected "hawk2: passwordless ssh authentication: FAIL." in stderr + When Run "crm cluster health hawk2 --fix" on "hanode1" + Then Expected "hawk2: passwordless ssh authentication: OK." in stdout + When Run "rm -rf ~hacluster/.ssh /root/.config/crm" on "hanode1" + And Try "crm cluster health hawk2" on "hanode1" + Then Expected "hawk2: passwordless ssh authentication: FAIL." in stderr + When Try "crm cluster health hawk2 --fix" on "hanode1" + Then Expected "Cannot fix automatically" in stderr