From 03330c36a4037410635f861af0b8d0646655273e Mon Sep 17 00:00:00 2001 From: Trent Lloyd Date: Fri, 8 Dec 2023 20:34:26 +0800 Subject: [PATCH 1/6] Avoid broken macaroonbakery release macaroonbakery 1.3.3 has a broken protobuf dependency, add a requirement to avoid that specific release: https://github.com/go-macaroon-bakery/py-macaroon-bakery/issues/94 Conflicts: test-requirements.txt (cherry picked from commit 8be49486c880b99c40253520dfcf110d5bf89c88) (cherry picked from commit 6307638cf4d486c2ecd47d4c34cccf34e1b1c76f) --- requirements.txt | 2 ++ setup.py | 3 +++ 2 files changed, 5 insertions(+) diff --git a/requirements.txt b/requirements.txt index cfa9f59c1..1abf6292c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -41,3 +41,5 @@ python-libmaas # Documentation requirements sphinx sphinxcontrib-asyncio +# https://github.com/go-macaroon-bakery/py-macaroon-bakery/issues/94 +macaroonbakery!=1.3.3 diff --git a/setup.py b/setup.py index 87445e411..2d41ffcf9 100644 --- a/setup.py +++ b/setup.py @@ -41,6 +41,9 @@ 'PyYAML', 'tenacity', 'python-libmaas', + + # https://github.com/go-macaroon-bakery/py-macaroon-bakery/issues/94 + 'macaroonbakery != 1.3.3', ] tests_require = [ From 67879beab0dadfc76be9c432fd342da680c325df Mon Sep 17 00:00:00 2001 From: James Page Date: Thu, 23 Feb 2023 10:01:25 +0000 Subject: [PATCH 2/6] Misc fixes for failing github workflows Add separate workflow for testing on Python 3.6 as this requires an older Ubuntu release. Fixup unit tests for compatibility with newer versions of mock. Drop latest/stable functional test targets - this is actually 2.9.x of Juju and is already covered by the 2.9 targets and we want to avoid suddenly picking up a new Juju version because this will break with the new approach to version alignment in the Python module for Juju. Drop 2.8 functional test target - its broken and we don't really support this version any longer. Fixup iptables forwarding issues from LXD containers with a flush and re-create of rules. (cherry picked from commit 9277a94c155da8dabb4d2d60c629bbc7fa9c6ccc) (cherry picked from commit ee92b9be26d4ae53157878df0a3a0771706a1ebd) (cherry picked from commit 355ad7a72340c1a801c2c042b3ec32f18d12c0e5) (cherry picked from commit af6f2d11d64946da05e287214e440ed0ba767e26) --- .github/workflows/tox.yaml | 39 +++++++++++++------ unit_tests/test_zaza_model.py | 10 +++-- .../utilities/test_zaza_utilities_generic.py | 2 +- 3 files changed, 35 insertions(+), 16 deletions(-) diff --git a/.github/workflows/tox.yaml b/.github/workflows/tox.yaml index 3bdd5dba2..a950db6ed 100644 --- a/.github/workflows/tox.yaml +++ b/.github/workflows/tox.yaml @@ -5,11 +5,36 @@ on: - pull_request jobs: + build_old_versions: + runs-on: ubuntu-20.04 + strategy: + matrix: + python-version: ['3.6', '3.7'] + + steps: + - uses: actions/checkout@v1 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install codecov tox tox-gh-actions + - name: Lint with tox + run: tox -e pep8 + - name: Test with tox + run: tox -e py + - name: Codecov + run: | + set -euxo pipefail + codecov --verbose --gcov-glob unit_tests/* + build: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.6, 3.7, 3.8, 3.9] + python-version: [3.8, 3.9] steps: - uses: actions/checkout@v1 @@ -35,21 +60,11 @@ jobs: fail-fast: false matrix: juju_channel: - - latest/stable - 2.9/stable - - 2.8/stable bundle: - first - second - third - exclude: - # disable 'first' and 'second' bundles for juju 2.8 since 'magpie' - # is not a promulgated charm in the charmstore, only on charmhub - # which 2.8 can't talk to. - - juju_channel: 2.8/stable - bundle: first - - juju_channel: 2.8/stable - bundle: second env: TEST_ZAZA_BUG_LP1987332: "on" # http://pad.lv/1987332 needs: build @@ -67,6 +82,8 @@ jobs: sudo chmod 666 /var/snap/lxd/common/lxd/unix.socket # until Juju provides stable IPv6-support we unfortunately need this lxc network set lxdbr0 ipv6.address none + sudo iptables -F FORWARD + sudo iptables -P FORWARD ACCEPT # pull images lxc image copy --alias juju/bionic/amd64 --copy-aliases ubuntu-daily:bionic local: lxc image copy --alias juju/focal/amd64 --copy-aliases ubuntu-daily:focal local: diff --git a/unit_tests/test_zaza_model.py b/unit_tests/test_zaza_model.py index d8a615d41..c8b0c9d1c 100644 --- a/unit_tests/test_zaza_model.py +++ b/unit_tests/test_zaza_model.py @@ -435,8 +435,9 @@ def test_block_until_auto_reconnect_model_disconnected_sync(self): # model.disconnect and model.connect should've each have been called # twice, once for run_in_model, and once each for the disconnection. self.Model_mock.disconnect.assert_has_calls([mock.call(), mock.call()]) - self.Model_mock.connect_model.has_calls([mock.call('modelname'), - mock.call('modelname')]) + self.Model_mock.connect_model.assert_has_calls( + [mock.call('modelname'), mock.call('testmodel')] + ) def test_block_until_auto_reconnect_model_disconnected_async(self): self._mocks_for_block_until_auto_reconnect_model( @@ -450,8 +451,9 @@ async def _async_true(): # model.disconnect and model.connect should've each have been called # twice, once for run_in_model, and once each for the disconnection. self.Model_mock.disconnect.assert_has_calls([mock.call(), mock.call()]) - self.Model_mock.connect_model.has_calls([mock.call('modelname'), - mock.call('modelname')]) + self.Model_mock.connect_model.assert_has_calls( + [mock.call('modelname'), mock.call('testmodel')] + ) def test_block_until_auto_reconnect_model_blocks_till_true(self): self._mocks_for_block_until_auto_reconnect_model(True, True) diff --git a/unit_tests/utilities/test_zaza_utilities_generic.py b/unit_tests/utilities/test_zaza_utilities_generic.py index bcad02dc4..4320062a8 100644 --- a/unit_tests/utilities/test_zaza_utilities_generic.py +++ b/unit_tests/utilities/test_zaza_utilities_generic.py @@ -243,7 +243,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_with() self.prepare_series_upgrade.assert_called_once_with( _machine_num, to_series=_to_series) self.wrap_do_release_upgrade.assert_called_once_with( From 5738c767de8a12a22c21f4d79c0670a50217d196 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Fri, 8 Dec 2023 14:05:40 -0500 Subject: [PATCH 3/6] Pin openstacksdk to fix the python 3.6 builds Commit b34de32a in openstacksdk replaced the appdirs library with the platformdirs library. The platformdirs library is not python 3.6 compatible and causes some challenges. Pin the openstacksdk to a lower version. Thanks to Billy Olsen for this patch. Taken from: https://review.opendev.org/c/openstack/charm-neutron-api/+/902607 (cherry picked from commit 3eb839cd5a560543e84f7bd44e07ac4ebf051393) --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 1abf6292c..89858c795 100644 --- a/requirements.txt +++ b/requirements.txt @@ -43,3 +43,4 @@ sphinx sphinxcontrib-asyncio # https://github.com/go-macaroon-bakery/py-macaroon-bakery/issues/94 macaroonbakery!=1.3.3 +openstacksdk<=1.5.0; # Pin to a lower version of openstacksdk due to introduced libraries From 5dcdd268fe839256a61cbc985d75bd13a75ad57c Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Fri, 8 Dec 2023 14:37:23 -0500 Subject: [PATCH 4/6] Pin juju<2.9.45.0 for py3.6 and py3.7 Starting at 2.9.45.0 the walrus operator is used, but it is not supported until py3.8. (cherry picked from commit bc5334f95b51274c9f7bb2643b0ef28bf597f585) --- requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 89858c795..ea8c7878d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,8 @@ pyparsing<3.0.0 # pin for aodhclient which is held for py35 aiounittest async_generator -juju<3.0 +juju<2.9.45.0; python_version < '3.8' +juju<3.0; python_version >= '3.8' kubernetes<18.0.0; python_version < '3.6' # pined, as juju uses kubernetes juju_wait PyYAML>=3.0 From f987b1b4942ac2d34634c11c70c67af9dff2357e Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Fri, 16 Jun 2023 11:32:45 -0400 Subject: [PATCH 5/6] Drop py36, py37, and py39 from github runners These are no longer needed on the stable/wallaby branch. (cherry picked from commit 6122daa374281224da65c79b78fd6d52ade1460e) (cherry picked from commit 772f976bb2aef4265fd09bc65411fff02d6e3153) (cherry picked from commit 59811f363a90909344b31431d7a2b0e2ae4ea1a4) --- .github/workflows/tox.yaml | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/.github/workflows/tox.yaml b/.github/workflows/tox.yaml index a950db6ed..d77812e4e 100644 --- a/.github/workflows/tox.yaml +++ b/.github/workflows/tox.yaml @@ -5,36 +5,11 @@ on: - pull_request jobs: - build_old_versions: - runs-on: ubuntu-20.04 - strategy: - matrix: - python-version: ['3.6', '3.7'] - - steps: - - uses: actions/checkout@v1 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install codecov tox tox-gh-actions - - name: Lint with tox - run: tox -e pep8 - - name: Test with tox - run: tox -e py - - name: Codecov - run: | - set -euxo pipefail - codecov --verbose --gcov-glob unit_tests/* - build: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.8, 3.9] + python-version: [3.8] steps: - uses: actions/checkout@v1 From b5c03ec8824267e6da97fbdebfe61f15faa5ef99 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Fri, 8 Dec 2023 15:50:03 -0500 Subject: [PATCH 6/6] Run github func job with py38 This avoids running with py310 which doesn't make sense for focal. (cherry picked from commit 7826a64b456f16e0d755f1706b4ff533c3287a4d) --- .github/workflows/tox.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/tox.yaml b/.github/workflows/tox.yaml index d77812e4e..3592bc89c 100644 --- a/.github/workflows/tox.yaml +++ b/.github/workflows/tox.yaml @@ -34,6 +34,7 @@ jobs: strategy: fail-fast: false matrix: + python-version: [3.8] juju_channel: - 2.9/stable bundle: @@ -45,6 +46,10 @@ jobs: needs: build steps: - uses: actions/checkout@v1 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} - name: Install dependencies run: | set -euxo pipefail