Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/tox.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
# - 3.1/stable
# - 3.2/stable
# - 3.3/stable
- 3.4/stable
- 3.6/stable
bundle:
- first
- second
Expand All @@ -59,9 +59,9 @@ jobs:
# - juju_channel: 3.3/stable
# snap_install_flags: ""
# pip_constraints: constraints-juju33.txt
- juju_channel: 3.4/stable
- juju_channel: 3.6/stable
snap_install_flags: ""
pip_constraints: constraints-juju34.txt
pip_constraints: constraints-juju36.txt
juju3: 1
env:
TEST_ZAZA_BUG_LP1987332: "on" # http://pad.lv/1987332
Expand Down
9 changes: 9 additions & 0 deletions constraints-juju36.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.6.0,<3.7.0
4 changes: 0 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,3 @@ sphinx
sphinxcontrib-asyncio
# https://github.com/go-macaroon-bakery/py-macaroon-bakery/issues/94
macaroonbakery!=1.3.3

# NOTE(freyes): Set upper bound for websockets until libjuju is compatible with
# newer versions. See https://github.com/juju/python-libjuju/pull/1208
websockets<13.0.0
3 changes: 0 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@

# https://github.com/go-macaroon-bakery/py-macaroon-bakery/issues/94
'macaroonbakery != 1.3.3',
# NOTE(freyes): Set upper bound for websockets until libjuju is compatible
# with newer versions. See https://github.com/juju/python-libjuju/pull/1208
'websockets<13.0.0',
]
if os.environ.get("TEST_JUJU3"):
install_require.append('juju')
Expand Down
4 changes: 0 additions & 4 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ keystoneauth1
oslo.config
python-novaclient
tenacity>8.2.0
# NOTE(freyes): Set upper bound for websockets until libjuju is compatible with
# newer versions. See https://github.com/juju/python-libjuju/pull/1208
websockets<13.0.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
Expand Down
14 changes: 14 additions & 0 deletions unit_tests/test_zaza_charm_lifecycle_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,17 @@ def test_parser_logging(self):
# Using args
args = lc_test.parse_args(['-m', 'model', '--log', 'DEBUG'])
self.assertEqual(args.loglevel, 'DEBUG')

def test_main(self):
self.patch_object(lc_test, 'parse_args')
self.patch_object(lc_test.cli_utils, 'setup_logging')
self.patch_object(lc_test, 'run_test_list')
args_mock = mock.MagicMock()
args_mock.loglevel = 'DEBUG'
args_mock.model = {'default_alias': 'modelname'}
args_mock.tests = ['test_class1', 'test_class2']
self.parse_args.return_value = args_mock
lc_test.main(['-m', 'modelname', 'test_class1', 'test_class2'])
self.setup_logging.assert_called_once_with(log_level='DEBUG')
self.run_test_list.assert_called_once_with(
['test_class1', 'test_class2'])
4 changes: 4 additions & 0 deletions zaza/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,10 @@ async def _runner():
if not RUN_LIBJUJU_IN_THREAD:
# run it in this thread's event loop:
loop = asyncio.get_event_loop()
# create a new loop if the existing one is closed
if loop.is_closed():
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
return loop.run_until_complete(_runner())

# ensure that the thread is created
Expand Down
6 changes: 4 additions & 2 deletions zaza/charm_lifecycle/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,15 @@ def add_config_option(config_item):
global_options.set_option(option, value)


def main():
def main(argv=None):
"""Run the tests defined by the command line args.

Run the tests defined by the command line args or if none were provided
read the tests from the charms tests.yaml config file

:param argv: List of command line arguments
"""
args = parse_args(sys.argv[1:])
args = parse_args(argv if argv else sys.argv[1:])
cli_utils.setup_logging(log_level=args.loglevel.upper())
zaza.model.set_juju_model_aliases(args.model)
utils.set_base_test_dir(test_dir=args.test_directory)
Expand Down