From 971bf80b1890a1cd1b324b3e096d06d54d81aaee Mon Sep 17 00:00:00 2001 From: Felipe Reyes Date: Mon, 27 Jun 2022 11:07:24 -0400 Subject: [PATCH] Don't test nrpe bits on rabbitmq-server. (#793) When the nrpe application is not deployed in the model skip the test that checks for the correct configuration of the nagios checks, this is because at the moment nrpe has no support for jammy, hence is not being deployed in the jammy-yoga bundles. Jammy support for nrpe is tracked at http://pad.lv/1968008 Also patch tox.ini and fix a test to allow the tests to pass. --- .github/workflows/tox.yaml | 2 +- requirements.txt | 3 ++- setup.py | 2 +- tox.ini | 4 ++++ unit_tests/utilities/test_zaza_utilities_series_upgrade.py | 2 +- zaza/openstack/charm_tests/rabbitmq_server/tests.py | 7 +++++++ 6 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tox.yaml b/.github/workflows/tox.yaml index ddfeff1e0..16fffe08a 100644 --- a/.github/workflows/tox.yaml +++ b/.github/workflows/tox.yaml @@ -20,7 +20,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install tox tox-gh-actions + pip install "tox<4.0" tox-gh-actions - name: Lint with tox run: tox -e pep8 - name: Test with tox diff --git a/requirements.txt b/requirements.txt index a6a567e42..f42b109cd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,7 +13,8 @@ juju_wait # https://github.com/pyca/pyopenssl/commit/a145fc3bc6d2e943434beb2f04bbf9b18930296f pyopenssl<22.1.0 -PyYAML<=4.2,>=3.0 +PyYAML<=4.2,>=3.0; python_version < '3.9' +PyYAML>4.2; python_version >='3.9' flake8>=2.2.4 flake8-docstrings flake8-per-file-ignores diff --git a/setup.py b/setup.py index 8fe59bfae..5f4f4f963 100644 --- a/setup.py +++ b/setup.py @@ -69,7 +69,7 @@ ] tests_require = [ - 'tox >= 2.3.1', + 'tox', ] diff --git a/tox.ini b/tox.ini index 2a8ae4b34..68e149122 100644 --- a/tox.ini +++ b/tox.ini @@ -15,12 +15,16 @@ skip_missing_interpreters = False # https://stackoverflow.com/a/38133283 requires = pip < 20.3 virtualenv < 20.0 + tox < 4.0.0 # NOTE: https://wiki.canonical.com/engineering/OpenStack/InstallLatestToxOnOsci minversion = 3.2.0 [testenv] setenv = VIRTUAL_ENV={envdir} PYTHONHASHSEED=0 +allowlist_externals = + {toxinidir}/pip.sh + install_command = {toxinidir}/pip.sh install {opts} {packages} diff --git a/unit_tests/utilities/test_zaza_utilities_series_upgrade.py b/unit_tests/utilities/test_zaza_utilities_series_upgrade.py index 340fc596e..cf0ab8e60 100644 --- a/unit_tests/utilities/test_zaza_utilities_series_upgrade.py +++ b/unit_tests/utilities/test_zaza_utilities_series_upgrade.py @@ -77,7 +77,7 @@ def test_series_upgrade(self): _unit, _machine_num, origin=_origin, to_series=_to_series, from_series=_from_series, workaround_script=_workaround_script, files=_files) - self.block_until_all_units_idle.called_with() + self.block_until_all_units_idle.assert_called() self.prepare_series_upgrade.assert_called_once_with( _machine_num, to_series=_to_series) self.wrap_do_release_upgrade.assert_called_once_with( diff --git a/zaza/openstack/charm_tests/rabbitmq_server/tests.py b/zaza/openstack/charm_tests/rabbitmq_server/tests.py index 027ef957d..9b18d8dca 100644 --- a/zaza/openstack/charm_tests/rabbitmq_server/tests.py +++ b/zaza/openstack/charm_tests/rabbitmq_server/tests.py @@ -271,6 +271,13 @@ def _retry_check_commands_on_units(self, cmds, units): def test_414_rmq_nrpe_monitors(self): """Check rabbimq-server nrpe monitor basic functionality.""" + try: + zaza.model.get_application("nrpe") + except KeyError: + logging.warn(("Skipping as nrpe is not deployed. " + "http://pad.lv/1968008")) + return + units = zaza.model.get_units(self.application_name) host_names = generic_utils.get_unit_hostnames(units)