Hello community, here is the log from the commit of package crmsh for openSUSE:Factory checked in at 2020-11-02 09:41:59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/crmsh (Old) and /work/SRC/openSUSE:Factory/.crmsh.new.3463 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "crmsh" Mon Nov 2 09:41:59 2020 rev:196 rq:845076 version:4.2.0+git.1604052559.2a348644 Changes: -------- --- /work/SRC/openSUSE:Factory/crmsh/crmsh.changes 2020-10-22 14:26:52.602997753 +0200 +++ /work/SRC/openSUSE:Factory/.crmsh.new.3463/crmsh.changes 2020-11-02 09:42:24.653726080 +0100 @@ -1,0 +2,25 @@ +Fri Oct 30 16:54:56 UTC 2020 - XLiang@suse.com + +- Update to version 4.2.0+git.1604052559.2a348644: + * Dev: behave: collect corosync.log if it defined in config file + * Fix: hb_report: collect corosync.log if it defined in config file(bsc#1148874) + * Dev: unittest: remove .travis.yml + * Dev: unittest: remove test case which might rely on runtime environment + * Dev: unittest: Create .github/workflows/crmsh-ci.yml, to use github action + * Dev: unittest: adjust duplicated test function name + +------------------------------------------------------------------- +Tue Oct 27 19:54:05 UTC 2020 - XLiang@suse.com + +- Update to version 4.2.0+git.1603805337.0e19de06: + * Dev: unittest: unit test for function do_start/do_stop + * Fix: ui_cluster: check service status while start/stop(bsc#1177980) + +------------------------------------------------------------------- +Tue Oct 27 10:41:09 UTC 2020 - XLiang@suse.com + +- Update to version 4.2.0+git.1603785356.e1de2810: + * Dev: unittest: adjust unit test for stop_services change + * Dev: bootstrap: stop service which is active, not which is available + +------------------------------------------------------------------- Old: ---- crmsh-4.2.0+git.1603292079.8fae778b.tar.bz2 New: ---- crmsh-4.2.0+git.1604052559.2a348644.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ crmsh.spec ++++++ --- /var/tmp/diff_new_pack.Fg7mLp/_old 2020-11-02 09:42:25.605726994 +0100 +++ /var/tmp/diff_new_pack.Fg7mLp/_new 2020-11-02 09:42:25.609726998 +0100 @@ -36,7 +36,7 @@ Summary: High Availability cluster command-line interface License: GPL-2.0-or-later Group: %{pkg_group} -Version: 4.2.0+git.1603292079.8fae778b +Version: 4.2.0+git.1604052559.2a348644 Release: 0 Url: http://crmsh.github.io Source0: %{name}-%{version}.tar.bz2 ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.Fg7mLp/_old 2020-11-02 09:42:25.653727040 +0100 +++ /var/tmp/diff_new_pack.Fg7mLp/_new 2020-11-02 09:42:25.653727040 +0100 @@ -5,4 +5,4 @@ <param name="url">https://github.com/liangxin1300/crmsh.git</param> <param name="changesrevision">d8dc51b4cb34964aa72e918999ebc7f03b48f3c9</param></service><service name="tar_scm"> <param name="url">https://github.com/ClusterLabs/crmsh.git</param> - <param name="changesrevision">8fae778bb08c028c0a42a49f432886dca8162a9a</param></service></servicedata> \ No newline at end of file + <param name="changesrevision">d94b31b1cb3775b03e2120e8fcf43d9b10019f0b</param></service></servicedata> \ No newline at end of file ++++++ crmsh-4.2.0+git.1603292079.8fae778b.tar.bz2 -> crmsh-4.2.0+git.1604052559.2a348644.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.2.0+git.1603292079.8fae778b/.github/workflows/crmsh-ci.yml new/crmsh-4.2.0+git.1604052559.2a348644/.github/workflows/crmsh-ci.yml --- old/crmsh-4.2.0+git.1603292079.8fae778b/.github/workflows/crmsh-ci.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/crmsh-4.2.0+git.1604052559.2a348644/.github/workflows/crmsh-ci.yml 2020-10-30 11:09:19.000000000 +0100 @@ -0,0 +1,203 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-w... +# For more information about secrets see: https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-... + +name: crmsh CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +env: + DOCKER_SCRIPT: ./test/docker_scripts.sh + FOLDER: /package + PACKAGE_NAME: crmsh + OBS_USER: ${{ secrets.OBS_USER }} + OBS_PASS: ${{ secrets.OBS_PASS }} + OBS_PROJECT: ${{ secrets.OBS_PROJECT }} + TARGET_PROJECT: ${{ secrets.TARGET_PROJECT }} + +jobs: + unit_test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install tox + - name: Test with pytest in tox + run: | + tox -v + + functional_test_hb_report_bugs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: functional test for hb_report + run: | + $DOCKER_SCRIPT hb_report before_install + $DOCKER_SCRIPT hb_report run bugs + + functional_test_bootstrap_bugs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: functional test for bootstrap bugs + run: | + $DOCKER_SCRIPT bootstrap before_install + $DOCKER_SCRIPT bootstrap run bugs + + functional_test_bootstrap_common: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: functional test for bootstrap common + run: | + $DOCKER_SCRIPT bootstrap before_install + $DOCKER_SCRIPT bootstrap run init_join_remove + + functional_test_bootstrap_options: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: functional test for bootstrap options + run: | + $DOCKER_SCRIPT bootstrap before_install + $DOCKER_SCRIPT bootstrap run options + + functional_test_qdevice_setup_remove: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: functional test for qdevice setup and remove + run: | + $DOCKER_SCRIPT qdevice before_install + $DOCKER_SCRIPT qdevice run setup_remove + + functional_test_qdevice_options: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: functional test for qdevice options + run: | + $DOCKER_SCRIPT qdevice before_install + $DOCKER_SCRIPT qdevice run options + + functional_test_qdevice_validate: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: functional test for qdevice validate + run: | + $DOCKER_SCRIPT qdevice before_install + $DOCKER_SCRIPT qdevice run validate + + functional_test_qdevice_user_case: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: functional test for qdevice user case + run: | + $DOCKER_SCRIPT qdevice before_install + $DOCKER_SCRIPT qdevice run usercase + + functional_test_resource_subcommand: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: functional test for resource subcommand + run: | + $DOCKER_SCRIPT resource before_install + $DOCKER_SCRIPT resource run + + functional_test_configure_sublevel: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: functional test for configure sublevel bugs + run: | + $DOCKER_SCRIPT configure before_install + $DOCKER_SCRIPT configure run bugs + + functional_test_constraints_bugs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: functional test for constraints bugs + run: | + $DOCKER_SCRIPT constraints before_install + $DOCKER_SCRIPT constraints run bugs + + functional_test_geo_cluster: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: functional test for geo cluster + run: | + $DOCKER_SCRIPT geo before_install + $DOCKER_SCRIPT geo run setup + + original_regression_test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: original regression test + run: | + $DOCKER_SCRIPT original before_install + $DOCKER_SCRIPT original run + + delivery: + needs: [unit_test, + functional_test_hb_report_bugs, + functional_test_bootstrap_bugs, + functional_test_bootstrap_common, + functional_test_bootstrap_options, + functional_test_qdevice_setup_remove, + functional_test_qdevice_options, + functional_test_qdevice_validate, + functional_test_qdevice_user_case, + functional_test_resource_subcommand, + functional_test_configure_sublevel, + functional_test_constraints_bugs, + functional_test_geo_cluster, + original_regression_test] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: delivery process + if: github.ref == 'refs/heads/master' && github.event_name == 'push' + run: | + docker pull shap/continuous_deliver:latest + docker run -t -v "$(pwd):/package" \ + -e OBS_USER=$OBS_USER \ + -e OBS_PASS=$OBS_PASS \ + -e FOLDER=$FOLDER \ + -e OBS_PROJECT=$OBS_PROJECT \ + -e PACKAGE_NAME=$PACKAGE_NAME \ + shap/continuous_deliver \ + /bin/bash -c "cd /package;/scripts/upload.sh" + + submit: + needs: delivery + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: submit process + if: github.ref == 'refs/heads/master' && github.event_name == 'push' + run: | + docker pull shap/continuous_deliver:latest + docker run -t -v "$(pwd):/package" \ + -e OBS_USER=$OBS_USER \ + -e OBS_PASS=$OBS_PASS \ + -e OBS_PROJECT=$OBS_PROJECT \ + -e PACKAGE_NAME=$PACKAGE_NAME \ + -e TARGET_PROJECT=$TARGET_PROJECT \ + shap/continuous_deliver \ + /bin/bash -c "cd /package;/scripts/submit.sh" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.2.0+git.1603292079.8fae778b/.travis.yml new/crmsh-4.2.0+git.1604052559.2a348644/.travis.yml --- old/crmsh-4.2.0+git.1603292079.8fae778b/.travis.yml 2020-10-21 16:54:39.000000000 +0200 +++ new/crmsh-4.2.0+git.1604052559.2a348644/.travis.yml 1970-01-01 01:00:00.000000000 +0100 @@ -1,150 +0,0 @@ ---- -sudo: required -language: python -services: - - docker - -stages: - - test - - delivery - - submit - -env: - global: - - CC_TEST_REPORTER_ID=a2579335b631ec35473874d7bb4fe983025c0287cea89c9dc34c35f98ee3963d - - FUNCTIONAL_TEST=$TRAVIS_BUILD_DIR/test/docker_scripts.sh - - IMAGE=liangxin1300/hatbw - -jobs: - include: - - stage: test - name: "unit test" - before_install: - - docker pull $IMAGE - script: - - docker run -t -v "$(pwd):/app" $IMAGE /bin/sh -c "cd /app; TOXENV=py38-codeclimate; tox" - - - name: "functional test for hb_report bugs" - before_install: - - $FUNCTIONAL_TEST hb_report before_install - script: - - $FUNCTIONAL_TEST hb_report run bugs - - - name: "regression test for bootstrap bugs" - before_install: - - $FUNCTIONAL_TEST bootstrap before_install - script: - - $FUNCTIONAL_TEST bootstrap run bugs - - - name: "functional test for bootstrap - init, join and remove" - before_install: - - $FUNCTIONAL_TEST bootstrap before_install - script: - - $FUNCTIONAL_TEST bootstrap run init_join_remove - - - name: "functional test for bootstrap - options" - before_install: - - $FUNCTIONAL_TEST bootstrap before_install - script: - - $FUNCTIONAL_TEST bootstrap run options - - - name: "functional test for qdevice - setup and remove" - before_install: - - $FUNCTIONAL_TEST qdevice before_install - script: - - $FUNCTIONAL_TEST qdevice run setup_remove - - - name: "functional test for qdevice - options" - before_install: - - $FUNCTIONAL_TEST qdevice before_install - script: - - $FUNCTIONAL_TEST qdevice run options - - - name: "functional test for qdevice - validate" - before_install: - - $FUNCTIONAL_TEST qdevice before_install - script: - - $FUNCTIONAL_TEST qdevice run validate - - - name: "functional test for qdevice - user case" - before_install: - - $FUNCTIONAL_TEST qdevice before_install - script: - - $FUNCTIONAL_TEST qdevice run usercase - - - name: "functional test for resource subcommand" - before_install: - - $FUNCTIONAL_TEST resource before_install - script: - - $FUNCTIONAL_TEST resource run - - - name: "functional test for configure sublevel bugs" - before_install: - - $FUNCTIONAL_TEST configure before_install - script: - - $FUNCTIONAL_TEST configure run bugs - - - name: "functional test for constraints bugs" - before_install: - - $FUNCTIONAL_TEST constraints before_install - script: - - $FUNCTIONAL_TEST constraints run bugs - - - name: "functional test for geo cluster" - before_install: - - $FUNCTIONAL_TEST geo before_install - script: - - $FUNCTIONAL_TEST geo run setup - - - name: "original regression test" - before_script: - - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-a... > ./cc-test-reporter - - chmod +x ./cc-test-reporter - - ./cc-test-reporter before-build - before_install: - - docker pull $IMAGE - script: - - docker run -t -v "$(pwd):/app" $IMAGE /bin/sh -c "cd /app; ./test/run-in-travis.sh" - after_failure: - - sudo cat $TRAVIS_BUILD_DIR/crmtestout/regression.out $TRAVIS_BUILD_DIR/crmtestout/crm.* - after_script: - - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT - - - stage: delivery - if: type != pull_request AND branch = master - env: - - FOLDER=/package - - PACKAGE_NAME=crmsh - - before_install: - - docker pull shap/continuous_deliver:latest - - script: - - | - docker run -t -v "$(pwd):/package" \ - -e OBS_USER=$OBS_USER \ - -e OBS_PASS=$OBS_PASS \ - -e FOLDER=$FOLDER \ - -e OBS_PROJECT=$OBS_PROJECT \ - -e PACKAGE_NAME=$PACKAGE_NAME \ - shap/continuous_deliver \ - /bin/bash -c "cd /package;/scripts/upload.sh" - - - stage: submit - if: type != pull_request AND branch = master - env: - - PACKAGE_NAME=crmsh - - before_install: - - docker pull shap/continuous_deliver:latest - - script: - - | - docker run -t -v "$(pwd):/package" \ - -e OBS_USER=$OBS_USER \ - -e OBS_PASS=$OBS_PASS \ - -e OBS_PROJECT=$OBS_PROJECT \ - -e PACKAGE_NAME=$PACKAGE_NAME \ - -e TARGET_PROJECT=$TARGET_PROJECT \ - shap/continuous_deliver \ - /bin/bash -c "cd /package;/scripts/submit.sh" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.2.0+git.1603292079.8fae778b/crmsh/bootstrap.py new/crmsh-4.2.0+git.1604052559.2a348644/crmsh/bootstrap.py --- old/crmsh-4.2.0+git.1603292079.8fae778b/crmsh/bootstrap.py 2020-10-21 16:54:39.000000000 +0200 +++ new/crmsh-4.2.0+git.1604052559.2a348644/crmsh/bootstrap.py 2020-10-30 11:09:19.000000000 +0100 @@ -2157,7 +2157,7 @@ Stop cluster related service """ for service in stop_list: - if utils.service_is_available(service, remote_addr=remote_addr): + if utils.service_is_active(service, remote_addr=remote_addr): status("Stopping the {}".format(service)) utils.stop_service(service, disable=True, remote_addr=remote_addr) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.2.0+git.1603292079.8fae778b/crmsh/ui_cluster.py new/crmsh-4.2.0+git.1604052559.2a348644/crmsh/ui_cluster.py --- old/crmsh-4.2.0+git.1603292079.8fae778b/crmsh/ui_cluster.py 2020-10-21 16:54:39.000000000 +0200 +++ new/crmsh-4.2.0+git.1604052559.2a348644/crmsh/ui_cluster.py 2020-10-30 11:09:19.000000000 +0100 @@ -92,6 +92,9 @@ Starts the cluster services on this node ''' try: + if utils.service_is_active("pacemaker.service"): + err_buf.info("Cluster services already started") + return utils.start_service("pacemaker") if utils.is_qdevice_configured(): utils.start_service("corosync-qdevice") @@ -107,6 +110,9 @@ Stops the cluster services on this node ''' try: + if not utils.service_is_active("corosync.service"): + err_buf.info("Cluster services already stopped") + return if utils.is_qdevice_configured(): utils.stop_service("corosync-qdevice") utils.stop_service("corosync") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.2.0+git.1603292079.8fae778b/hb_report/utillib.py new/crmsh-4.2.0+git.1604052559.2a348644/hb_report/utillib.py --- old/crmsh-4.2.0+git.1603292079.8fae778b/hb_report/utillib.py 2020-10-21 16:54:39.000000000 +0200 +++ new/crmsh-4.2.0+git.1604052559.2a348644/hb_report/utillib.py 2020-10-30 11:09:19.000000000 +0100 @@ -27,6 +27,7 @@ import crmsh.config from crmsh import msg as crmmsg from crmsh import utils as crmutils +from crmsh import corosync class Tempfile(object): @@ -312,7 +313,13 @@ for p in process_list: p.join() - for l in constants.EXTRA_LOGS.split(): + logfile_list = [] + corosync_log = corosync.get_value('logging.logfile') + if corosync_log: + logfile_list.append(corosync_log) + logfile_list += constants.EXTRA_LOGS.split() + + for l in logfile_list: if not os.path.isfile(l): continue if l == constants.HA_LOG and l != constants.HALOG_F: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.2.0+git.1603292079.8fae778b/test/features/hb_report_bugs.feature new/crmsh-4.2.0+git.1604052559.2a348644/test/features/hb_report_bugs.feature --- old/crmsh-4.2.0+git.1603292079.8fae778b/test/features/hb_report_bugs.feature 2020-10-21 16:54:39.000000000 +0200 +++ new/crmsh-4.2.0+git.1604052559.2a348644/test/features/hb_report_bugs.feature 2020-10-30 11:09:19.000000000 +0100 @@ -43,6 +43,22 @@ When Run "rm -rf report1.tar.gz report1" on "hanode1" @clean + Scenario: Collect corosync.log(bsc#1148874) + When Run "sed -i 's/\(\s*logfile:\s*\).*/\1\/var\/log\/cluster\/corosync.log/' /etc/corosync/corosync.conf" on "hanode1" + And Run "hb_report report" on "hanode1" + And Run "tar jxf report.tar.bz2" on "hanode1" + Then File "corosync.log" not in "report.tar.bz2" + When Run "rm -rf report.tar.gz report" on "hanode1" + + When Run "sed -i 's/\(\s*to_logfile:\s*\).*/\1yes/' /etc/corosync/corosync.conf" on "hanode1" + And Run "crm cluster stop" on "hanode1" + And Run "crm cluster start" on "hanode1" + And Run "hb_report report" on "hanode1" + And Run "tar jxf report.tar.bz2" on "hanode1" + Then File "corosync.log" in "report.tar.bz2" + When Run "rm -rf report.tar.gz report" on "hanode1" + + @clean Scenario: Replace sensitive data(bsc#1163581) # Set sensitive data TEL and password When Run "crm node utilization hanode1 set TEL 13356789876" on "hanode1" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.2.0+git.1603292079.8fae778b/test/run-in-travis.sh new/crmsh-4.2.0+git.1604052559.2a348644/test/run-in-travis.sh --- old/crmsh-4.2.0+git.1603292079.8fae778b/test/run-in-travis.sh 2020-10-21 16:54:39.000000000 +0200 +++ new/crmsh-4.2.0+git.1604052559.2a348644/test/run-in-travis.sh 2020-10-30 11:09:19.000000000 +0100 @@ -30,7 +30,7 @@ bootstrap|qdevice|hb_report|resource|geo|configure|constraints) functional_tests $1 $2 exit $?;; - *) + *|original) configure make_install regression_tests;; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.2.0+git.1603292079.8fae778b/test/testcases/scripts.exp new/crmsh-4.2.0+git.1604052559.2a348644/test/testcases/scripts.exp --- old/crmsh-4.2.0+git.1603292079.8fae778b/test/testcases/scripts.exp 2020-10-21 16:54:39.000000000 +0200 +++ new/crmsh-4.2.0+git.1604052559.2a348644/test/testcases/scripts.exp 2020-10-30 11:09:19.000000000 +0100 @@ -8,7 +8,6 @@ .EXT crm_resource --show-metadata ocf:heartbeat:db2 .EXT crm_resource --show-metadata ocf:heartbeat:exportfs .EXT crm_resource --show-metadata systemd:haproxy -ERROR: 2: Error when loading script haproxy: No meta-data for agent: systemd:haproxy .EXT crm_resource --show-metadata ocf:heartbeat:LVM .EXT crm_resource --show-metadata ocf:heartbeat:MailTo .EXT crm_resource --show-metadata ocf:heartbeat:nginx @@ -54,6 +53,7 @@ Server: apache Apache Webserver +haproxy HAProxy nginx Nginx Webserver Stonith: @@ -63,7 +63,6 @@ vmware Fencing using vCenter / ESX Server .INP: list all -ERROR: 3: Error when loading script haproxy: No meta-data for agent: systemd:haproxy Basic: health Verify health and configuration @@ -115,6 +114,7 @@ Server: apache Apache Webserver +haproxy HAProxy nginx Nginx Webserver Stonith: @@ -134,7 +134,7 @@ exportfs filesystem gfs2 -ERROR: 4: Error when loading script haproxy: No meta-data for agent: systemd:haproxy +haproxy health libvirt lvm-drbd diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.2.0+git.1603292079.8fae778b/test/unittests/test_bootstrap.py new/crmsh-4.2.0+git.1604052559.2a348644/test/unittests/test_bootstrap.py --- old/crmsh-4.2.0+git.1603292079.8fae778b/test/unittests/test_bootstrap.py 2020-10-21 16:54:39.000000000 +0200 +++ new/crmsh-4.2.0+git.1604052559.2a348644/test/unittests/test_bootstrap.py 2020-10-30 11:09:19.000000000 +0100 @@ -1427,11 +1427,11 @@ @mock.patch('crmsh.utils.stop_service') @mock.patch('crmsh.bootstrap.status') - @mock.patch('crmsh.utils.service_is_available') - def test_stop_services(self, mock_available, mock_status, mock_stop): - mock_available.side_effect = [True, True, True] + @mock.patch('crmsh.utils.service_is_active') + def test_stop_services(self, mock_active, mock_status, mock_stop): + mock_active.side_effect = [True, True, True] bootstrap.stop_services(bootstrap.SERVICES_STOP_LIST) - mock_available.assert_has_calls([ + mock_active.assert_has_calls([ mock.call("corosync-qdevice.service", remote_addr=None), mock.call("corosync.service", remote_addr=None), mock.call("hawk.service", remote_addr=None) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.2.0+git.1603292079.8fae778b/test/unittests/test_bugs.py new/crmsh-4.2.0+git.1604052559.2a348644/test/unittests/test_bugs.py --- old/crmsh-4.2.0+git.1603292079.8fae778b/test/unittests/test_bugs.py 2020-10-21 16:54:39.000000000 +0200 +++ new/crmsh-4.2.0+git.1604052559.2a348644/test/unittests/test_bugs.py 2020-10-30 11:09:19.000000000 +0100 @@ -879,7 +879,7 @@ assert obj.cli_use_validate() -def test_dup_create(): +def test_dup_create_same_name(): """ Creating two objects with the same name """ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.2.0+git.1603292079.8fae778b/test/unittests/test_cliformat.py new/crmsh-4.2.0+git.1604052559.2a348644/test/unittests/test_cliformat.py --- old/crmsh-4.2.0+git.1603292079.8fae778b/test/unittests/test_cliformat.py 2020-10-21 16:54:39.000000000 +0200 +++ new/crmsh-4.2.0+git.1604052559.2a348644/test/unittests/test_cliformat.py 2020-10-30 11:09:19.000000000 +0100 @@ -61,6 +61,7 @@ roundtrip('rsc_template public_vm Xen') +''' Seems rely on cluster env, should be in functional test def test_normalize(): """ Test automatic normalization of parameter names: @@ -69,6 +70,7 @@ """ roundtrip('primitive vm1 Xen params shutdown-timeout=0', expected='primitive vm1 Xen params shutdown_timeout=0') +''' def test_group(): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.2.0+git.1603292079.8fae778b/test/unittests/test_corosync.py new/crmsh-4.2.0+git.1604052559.2a348644/test/unittests/test_corosync.py --- old/crmsh-4.2.0+git.1603292079.8fae778b/test/unittests/test_corosync.py 2020-10-21 16:54:39.000000000 +0200 +++ new/crmsh-4.2.0+git.1604052559.2a348644/test/unittests/test_corosync.py 2020-10-30 11:09:19.000000000 +0100 @@ -134,7 +134,7 @@ @mock.patch("crmsh.corosync.get_value") @mock.patch("crmsh.utils.is_qdevice_configured") -def test_query_qnetd_status_no_cluster_name(mock_qdevice_configured, mock_get_value): +def test_query_qnetd_status_no_host(mock_qdevice_configured, mock_get_value): mock_qdevice_configured.return_value = True mock_get_value.side_effect = ["hacluster", None] with pytest.raises(ValueError) as err: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.2.0+git.1603292079.8fae778b/test/unittests/test_report.py new/crmsh-4.2.0+git.1604052559.2a348644/test/unittests/test_report.py --- old/crmsh-4.2.0+git.1603292079.8fae778b/test/unittests/test_report.py 2020-10-21 16:54:39.000000000 +0200 +++ new/crmsh-4.2.0+git.1604052559.2a348644/test/unittests/test_report.py 2020-10-30 11:09:19.000000000 +0100 @@ -222,10 +222,6 @@ def test_grep(): - res = grep("^Name", incmd="rpm -qi bash")[0] - _, out = get_command_info("rpm -qi bash|grep \"^Name\"") - assert res == out.strip("\n") - in_string = """aaaa bbbb """ @@ -343,7 +339,7 @@ @mock.patch('crmsh.utils.get_stdout_stderr') -def test_dump_D_process_None(mock_get_stdout_stderr): +def test_dump_D_process(mock_get_stdout_stderr): mock_get_stdout_stderr.side_effect = [ (0, "10001\n10002", None), (0, "comm_out for 10001", None), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.2.0+git.1603292079.8fae778b/test/unittests/test_ui_cluster.py new/crmsh-4.2.0+git.1604052559.2a348644/test/unittests/test_ui_cluster.py --- old/crmsh-4.2.0+git.1603292079.8fae778b/test/unittests/test_ui_cluster.py 1970-01-01 01:00:00.000000000 +0100 +++ new/crmsh-4.2.0+git.1604052559.2a348644/test/unittests/test_ui_cluster.py 2020-10-30 11:09:19.000000000 +0100 @@ -0,0 +1,85 @@ +import unittest +try: + from unittest import mock +except ImportError: + import mock + +from crmsh import ui_cluster + + +class TestCluster(unittest.TestCase): + """ + Unitary tests for class utils.IP + """ + @classmethod + def setUpClass(cls): + """ + Global setUp. + """ + + def setUp(self): + """ + Test setUp. + """ + self.ui_cluster_inst = ui_cluster.Cluster() + + def tearDown(self): + """ + Test tearDown. + """ + + @classmethod + def tearDownClass(cls): + """ + Global tearDown. + """ + + @mock.patch('crmsh.ui_cluster.err_buf.info') + @mock.patch('crmsh.utils.service_is_active') + def test_do_start_already_started(self, mock_active, mock_info): + context_inst = mock.Mock() + mock_active.return_value = True + self.ui_cluster_inst.do_start(context_inst) + mock_active.assert_called_once_with("pacemaker.service") + mock_info.assert_called_once_with("Cluster services already started") + + @mock.patch('crmsh.ui_cluster.err_buf.info') + @mock.patch('crmsh.utils.is_qdevice_configured') + @mock.patch('crmsh.utils.start_service') + @mock.patch('crmsh.utils.service_is_active') + def test_do_start(self, mock_active, mock_start, mock_qdevice_configured, mock_info): + context_inst = mock.Mock() + mock_active.return_value = False + mock_qdevice_configured.return_value = True + + self.ui_cluster_inst.do_start(context_inst) + + mock_active.assert_called_once_with("pacemaker.service") + mock_start.assert_has_calls([mock.call("pacemaker"), mock.call("corosync-qdevice")]) + mock_qdevice_configured.assert_called_once_with() + mock_info.assert_called_once_with("Cluster services started") + + @mock.patch('crmsh.ui_cluster.err_buf.info') + @mock.patch('crmsh.utils.service_is_active') + def test_do_stop_already_stopped(self, mock_active, mock_info): + context_inst = mock.Mock() + mock_active.return_value = False + self.ui_cluster_inst.do_stop(context_inst) + mock_active.assert_called_once_with("corosync.service") + mock_info.assert_called_once_with("Cluster services already stopped") + + @mock.patch('crmsh.ui_cluster.err_buf.info') + @mock.patch('crmsh.utils.is_qdevice_configured') + @mock.patch('crmsh.utils.stop_service') + @mock.patch('crmsh.utils.service_is_active') + def test_do_stop(self, mock_active, mock_stop, mock_qdevice_configured, mock_info): + context_inst = mock.Mock() + mock_active.return_value = True + mock_qdevice_configured.return_value = True + + self.ui_cluster_inst.do_stop(context_inst) + + mock_active.assert_called_once_with("corosync.service") + mock_stop.assert_has_calls([mock.call("corosync-qdevice"), mock.call("corosync")]) + mock_qdevice_configured.assert_called_once_with() + mock_info.assert_called_once_with("Cluster services stopped") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crmsh-4.2.0+git.1603292079.8fae778b/test/unittests/test_utils.py new/crmsh-4.2.0+git.1604052559.2a348644/test/unittests/test_utils.py --- old/crmsh-4.2.0+git.1603292079.8fae778b/test/unittests/test_utils.py 2020-10-21 16:54:39.000000000 +0200 +++ new/crmsh-4.2.0+git.1604052559.2a348644/test/unittests/test_utils.py 2020-10-30 11:09:19.000000000 +0100 @@ -234,7 +234,7 @@ @mock.patch('crmsh.utils.this_node') @mock.patch('crmsh.utils.list_cluster_nodes') -def test_list_cluster_nodes_except_me_exception(mock_list_nodes, mock_this_node): +def test_list_cluster_nodes_except_me(mock_list_nodes, mock_this_node): mock_list_nodes.return_value = ["node1", "node2"] mock_this_node.return_value = "node1" res = utils.list_cluster_nodes_except_me()