Merge ~vultaire/charm-juju-controller:functest-fix into charm-juju-controller:master

Proposed by Paul Goins
Status: Merged
Approved by: James Troup
Approved revision: bcb1ef16ee3dcdcd40908f38023fa6e7290b4b2a
Merged at revision: 5fb92590ad858507172a49f0c0d346d06036b50e
Proposed branch: ~vultaire/charm-juju-controller:functest-fix
Merge into: charm-juju-controller:master
Diff against target: 81 lines (+6/-17)
5 files modified
src/tests/functional/tests/bundles/overlays/bionic.yaml.j2 (+0/-3)
src/tests/functional/tests/bundles/overlays/focal.yaml.j2 (+0/-3)
src/tests/functional/tests/bundles/overlays/local-charm-overlay.yaml.j2 (+1/-1)
src/tests/functional/tests/tests_juju_controller.py (+3/-10)
src/tox.ini (+2/-0)
Reviewer Review Type Date Requested Status
Xav Paice (community) Approve
🤖 prod-jenkaas-bootstack (community) continuous-integration Approve
BootStack Reviewers Pending
Review via email: mp+406317@code.launchpad.net

Commit message

Multiple fixes to enable functional tests

Added a TEST_REPO_ROOT env var, which will be passed through by zaza,
for exposing the root directory of the repository. This allows us
to cleanly refer to the locally-prepped customized Ubuntu charm
required for functional testing.

Additionally, refactored overlays to reduce duplication, and added
a missing num_units setting needed for proper deployment.

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :

A CI job is currently in progress. A follow up comment will be added when it completes.

Revision history for this message
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :

A CI job is currently in progress. A follow up comment will be added when it completes.

Revision history for this message
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :

A CI job is currently in progress. A follow up comment will be added when it completes.

Revision history for this message
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :
review: Approve (continuous-integration)
Revision history for this message
Xav Paice (xavpaice) wrote :

lgtm

review: Approve
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision 5fb92590ad858507172a49f0c0d346d06036b50e

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/tests/functional/tests/bundles/overlays/bionic.yaml.j2 b/src/tests/functional/tests/bundles/overlays/bionic.yaml.j2
2index fad7d28..65b2826 100644
3--- a/src/tests/functional/tests/bundles/overlays/bionic.yaml.j2
4+++ b/src/tests/functional/tests/bundles/overlays/bionic.yaml.j2
5@@ -1,4 +1 @@
6 series: bionic
7-applications:
8- {{ charm_name }}:
9- charm: "{{ CHARM_BUILD_DIR }}/{{ charm_name }}"
10diff --git a/src/tests/functional/tests/bundles/overlays/focal.yaml.j2 b/src/tests/functional/tests/bundles/overlays/focal.yaml.j2
11index 1eabba4..d3f46ab 100644
12--- a/src/tests/functional/tests/bundles/overlays/focal.yaml.j2
13+++ b/src/tests/functional/tests/bundles/overlays/focal.yaml.j2
14@@ -1,4 +1 @@
15 series: focal
16-applications:
17- {{ charm_name }}:
18- charm: "{{ CHARM_BUILD_DIR }}/{{ charm_name }}"
19diff --git a/src/tests/functional/tests/bundles/overlays/local-charm-overlay.yaml.j2 b/src/tests/functional/tests/bundles/overlays/local-charm-overlay.yaml.j2
20index 4d6e8b6..f4145eb 100644
21--- a/src/tests/functional/tests/bundles/overlays/local-charm-overlay.yaml.j2
22+++ b/src/tests/functional/tests/bundles/overlays/local-charm-overlay.yaml.j2
23@@ -1,3 +1,3 @@
24 applications:
25 ubuntu:
26- charm: {{ CHARM_BUILD_DIR }}/../testing-charms/ubuntu-lxd-profile
27+ charm: {{ TEST_REPO_ROOT }}/testing-charms/ubuntu-lxd-profile
28diff --git a/src/tests/functional/tests/tests_juju_controller.py b/src/tests/functional/tests/tests_juju_controller.py
29index 110cb20..fd7b048 100644
30--- a/src/tests/functional/tests/tests_juju_controller.py
31+++ b/src/tests/functional/tests/tests_juju_controller.py
32@@ -5,8 +5,7 @@ import os
33 import unittest
34 from pathlib import Path
35
36-from zaza import model, sync_wrapper
37-from zaza.charm_lifecycle import utils as lifecycle_utils
38+from zaza import model
39
40
41 CHARM_BUILD_DIR = os.environ.get("CHARM_BUILD_DIR", "/tmp/charm-builds")
42@@ -39,27 +38,21 @@ async def check_for_inner_status(unit, inner_model, inner_app, target="active"):
43 return False
44
45
46-async def async_block_until_inner_app(unit, inner_model, app):
47+def block_until_inner_app(unit, inner_model, app):
48 """Wait for app to be active."""
49- await model.async_block_until(
50+ model.block_until(
51 lambda: check_for_inner_status(unit, inner_model, app),
52 timeout=600,
53 wait_period=2,
54 )
55
56
57-block_until_inner_app = sync_wrapper(async_block_until_inner_app)
58-
59-
60 class JujuControllerTestBase(unittest.TestCase):
61 """Base class for charm functional tests."""
62
63 @classmethod
64 def setUpClass(cls):
65 """Set up test environment."""
66- cls.model_name = model.get_juju_model()
67- cls.test_config = lifecycle_utils.get_charm_config()
68- model.block_until_all_units_idle()
69 cls.unit = "ubuntu/0"
70 cls.enable_ha()
71 cls.deploy_juju_controller()
72diff --git a/src/tox.ini b/src/tox.ini
73index 24fb13b..b16ed99 100644
74--- a/src/tox.ini
75+++ b/src/tox.ini
76@@ -69,3 +69,5 @@ deps = -r{toxinidir}/tests/unit/requirements.txt
77 changedir = {toxinidir}/tests/functional
78 commands = functest-run-suite {posargs}
79 deps = -r{toxinidir}/tests/functional/requirements.txt
80+setenv =
81+ TEST_REPO_ROOT = {toxinidir}/..

Subscribers

People subscribed via source and target branches

to all changes: