Skip to content

Commit

Permalink
Merge pull request #608 from freyes/issues/545
Browse files Browse the repository at this point in the history
Juju 3.x Support
  • Loading branch information
ajkavanagh authored Feb 20, 2024
2 parents d7520d3 + aec6e76 commit c44d359
Show file tree
Hide file tree
Showing 18 changed files with 562 additions and 39 deletions.
32 changes: 28 additions & 4 deletions .github/workflows/tox.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ jobs:
strategy:
matrix:
python-version: ['3.8', '3.10', '3.11']

steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -36,10 +35,30 @@ jobs:
matrix:
juju_channel:
- 2.9/stable
- 3.1/stable
# - 3.2/stable
# - 3.3/stable
bundle:
- first
- second
- third
include:
- juju_channel: 2.9/stable
snap_install_flags: "--classic"
pip_constraints: constraints-juju29.txt
- juju_channel: 3.1/stable
snap_install_flags: ""
pip_constraints: constraints-juju31.txt
# NOTE(freyes): disabled until "RuntimeError: set_wakeup_fd only works
# in main thread of the main interpreter" gets fixed.
# https://pastebin.ubuntu.com/p/GfYKgpx3SP/
#
# - juju_channel: 3.2/stable
# snap_install_flags: ""
# pip_constraints: constraints-juju32.txt
# - juju_channel: 3.3/stable
# snap_install_flags: ""
# pip_constraints: constraints-juju33.txt
env:
TEST_ZAZA_BUG_LP1987332: "on" # http://pad.lv/1987332
needs: build
Expand All @@ -48,9 +67,13 @@ jobs:
- name: Install dependencies
run: |
set -euxo pipefail
sudo apt-get update
sudo apt-get install -yq snapd
sudo systemctl enable snapd
sudo systemctl restart snapd
python -m pip install --upgrade pip
pip install tox tox-gh-actions
sudo snap install --channel ${{ matrix.juju_channel }} --classic juju
sudo snap install ${{ matrix.snap_install_flags }} --channel ${{ matrix.juju_channel }} juju
sudo snap install --classic juju-crashdump
sudo lxd init --auto
# This is a throw-away CI environment, do not do this at home
Expand All @@ -64,11 +87,12 @@ jobs:
lxc image copy --alias juju/focal/amd64 --copy-aliases ubuntu-daily:focal local:
lxc image copy --alias juju/jammy/amd64 --copy-aliases ubuntu-daily:jammy local:
lxc image list
juju bootstrap --no-gui localhost
juju bootstrap localhost
- name: Functional test
run: |
set -euxo pipefail
mkdir logs
export PIP_CONSTRAINTS=$(pwd)/${{ matrix.pip_constraints }}
tox -e func-target -- ${{ matrix.bundle }} | tee logs/tox-output.txt
- name: crashdump on failure
if: failure()
Expand All @@ -77,7 +101,7 @@ jobs:
juju models
model=$(juju models --format yaml|grep "^- name:.*zaza"|cut -f2 -d/)
juju status -m $model | tee logs/juju-status.txt
juju crashdump -m $model -o logs/
juju-crashdump -m $model -o logs/
- name: upload logs on failure
if: failure()
uses: actions/upload-artifact@v2
Expand Down
9 changes: 9 additions & 0 deletions constraints-juju-default.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# NOTE: this constraints file can be (and will be) consumed by downstream users.
#
# Known consumers:
# * zosci-config: job definitions that declare what juju version (snap channel)
# is used in tandem with this constraints file to lockdown python-libjuju
# version.
# * zaza-openstack-tests
#
juju>=3.1.0,<3.2.0
11 changes: 11 additions & 0 deletions constraints-juju29.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# NOTE: this constraints file can be (and will be) consumed by downstream users.
#
# Known consumers:
# * zosci-config: job definitions that declare what juju version (snap channel)
# is used in tandem with this constraints file to lockdown python-libjuju
# version.
# * zaza-openstack-tests
#
# Reasons to block the use of a release:
# * 2.9.45, 2.9.46 - https://github.com/juju/python-libjuju/pull/975
juju>=2.9.0,<3.0.0,!=2.9.45,!=2.9.46
9 changes: 9 additions & 0 deletions constraints-juju31.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# NOTE: this constraints file can be (and will be) consumed by downstream users.
#
# Known consumers:
# * zosci-config: job definitions that declare what juju version (snap channel)
# is used in tandem with this constraints file to lockdown python-libjuju
# version.
# * zaza-openstack-tests
#
juju>=3.1.0,<3.2.0
9 changes: 9 additions & 0 deletions constraints-juju32.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# NOTE: this constraints file can be (and will be) consumed by downstream users.
#
# Known consumers:
# * zosci-config: job definitions that declare what juju version (snap channel)
# is used in tandem with this constraints file to lockdown python-libjuju
# version.
# * zaza-openstack-tests
#
juju>=3.2.0,<3.3.0
9 changes: 9 additions & 0 deletions constraints-juju33.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# NOTE: this constraints file can be (and will be) consumed by downstream users.
#
# Known consumers:
# * zosci-config: job definitions that declare what juju version (snap channel)
# is used in tandem with this constraints file to lockdown python-libjuju
# version.
# * zaza-openstack-tests
#
juju>=3.3.0,<3.4.0
2 changes: 0 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
pyparsing<3.0.0 # pin for aodhclient which is held for py35
async_generator
kubernetes<18.0.0; python_version < '3.6' # pined, as juju uses kubernetes
# pinned until 3.0 regressions are handled: https://github.com/openstack-charmers/zaza/issues/545
juju<3.0
juju_wait
PyYAML>=3.0
pbr==5.6.0
Expand Down
10 changes: 6 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,24 @@

'hvac<0.7.0',
'jinja2',
'juju<3.0',
'juju-wait',
'PyYAML',
'tenacity>8.2.0',
'python-libmaas',

# https://github.com/go-macaroon-bakery/py-macaroon-bakery/issues/94
'macaroonbakery != 1.3.3',
'juju',
]

tests_require = [
'tox >= 2.3.1',
]

extras_require = {
'testing': tests_require,
}


class Tox(TestCommand):
"""Tox class."""
Expand Down Expand Up @@ -113,8 +117,6 @@ def run_tests(self):
zip_safe=False,
cmdclass={'test': Tox},
install_requires=install_require,
extras_require={
'testing': tests_require,
},
tests_require=tests_require,
extras_require=extras_require,
)
5 changes: 3 additions & 2 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ keystoneauth1
oslo.config
python-novaclient
tenacity>8.2.0
# pinned until 3.0 regressions are handled: https://github.com/openstack-charmers/zaza/issues/545
juju<3.0
# To force the installation of an specific version of libjuju use a constraints
# file, e.g.: `env PIP_CONSTRAINTS=./constraints-juju31.txt tox -e func-target`
juju
# https://github.com/go-macaroon-bakery/py-macaroon-bakery/issues/94
macaroonbakery!=1.3.3
16 changes: 5 additions & 11 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
envlist = pep8,py3
skipsdist = True
skipsdist = False

# NOTE: https://wiki.canonical.com/engineering/OpenStack/InstallLatestToxOnOsci
minversion = 3.2.0
Expand All @@ -17,59 +17,53 @@ passenv =
CS_*
OS_*
TEST_*
PIP_*
deps =
-c{env:PIP_CONSTRAINTS:{toxinidir}/constraints-juju29.txt}
-r{toxinidir}/test-requirements.txt
commands = pytest --cov=./zaza/ {posargs} {toxinidir}/unit_tests

[testenv:py3]
basepython = python3
deps = -r{toxinidir}/test-requirements.txt

[testenv:pep8]
basepython = python3
deps = -r{toxinidir}/test-requirements.txt
commands = flake8 {posargs} zaza unit_tests

[testenv:venv]
basepython = python3
deps = -r{toxinidir}/test-requirements.txt
commands = /bin/true

[flake8]
ignore = E402,E226,W504
deps = -r{toxinidir}/test-requirements.txt
per-file-ignores =
unit_tests/**: D

[testenv:docs]
basepython = python3
changedir = doc/source
deps =
-r{toxinidir}/doc-requirements.txt
commands = sphinx-build -W -b html -d {toxinidir}/doc/build/doctrees . {toxinidir}/doc/build/html

[testenv:func]
basepython = python3
deps = -r{toxinidir}/test-requirements.txt
commands =
{envdir}/bin/python3 setup.py install
functest-run-suite --keep-faulty-model

[testenv:func-target]
basepython = python3
deps = -r{toxinidir}/test-requirements.txt
commands =
{envdir}/bin/python3 setup.py install
functest-run-suite --keep-model --bundle {posargs}

[testenv:func-target-extended]
basepython = python3
deps = -r{toxinidir}/test-requirements.txt
commands =
{envdir}/bin/python3 setup.py install
functest-run-suite --keep-model --test-directory {toxinidir}/tests-extended --log INFO --bundle {posargs}

[testenv:remove-placement]
basepython = python3
deps = -r{toxinidir}/test-requirements.txt
commands =
{envdir}/bin/python3 setup.py install
remove-placement {posargs}
Loading

0 comments on commit c44d359

Please sign in to comment.