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
diff --git a/src/tests/functional/tests/bundles/overlays/bionic.yaml.j2 b/src/tests/functional/tests/bundles/overlays/bionic.yaml.j2
index fad7d28..65b2826 100644
--- a/src/tests/functional/tests/bundles/overlays/bionic.yaml.j2
+++ b/src/tests/functional/tests/bundles/overlays/bionic.yaml.j2
@@ -1,4 +1 @@
1series: bionic1series: bionic
2applications:
3 {{ charm_name }}:
4 charm: "{{ CHARM_BUILD_DIR }}/{{ charm_name }}"
diff --git a/src/tests/functional/tests/bundles/overlays/focal.yaml.j2 b/src/tests/functional/tests/bundles/overlays/focal.yaml.j2
index 1eabba4..d3f46ab 100644
--- a/src/tests/functional/tests/bundles/overlays/focal.yaml.j2
+++ b/src/tests/functional/tests/bundles/overlays/focal.yaml.j2
@@ -1,4 +1 @@
1series: focal1series: focal
2applications:
3 {{ charm_name }}:
4 charm: "{{ CHARM_BUILD_DIR }}/{{ charm_name }}"
diff --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
index 4d6e8b6..f4145eb 100644
--- a/src/tests/functional/tests/bundles/overlays/local-charm-overlay.yaml.j2
+++ b/src/tests/functional/tests/bundles/overlays/local-charm-overlay.yaml.j2
@@ -1,3 +1,3 @@
1applications:1applications:
2 ubuntu:2 ubuntu:
3 charm: {{ CHARM_BUILD_DIR }}/../testing-charms/ubuntu-lxd-profile3 charm: {{ TEST_REPO_ROOT }}/testing-charms/ubuntu-lxd-profile
diff --git a/src/tests/functional/tests/tests_juju_controller.py b/src/tests/functional/tests/tests_juju_controller.py
index 110cb20..fd7b048 100644
--- a/src/tests/functional/tests/tests_juju_controller.py
+++ b/src/tests/functional/tests/tests_juju_controller.py
@@ -5,8 +5,7 @@ import os
5import unittest5import unittest
6from pathlib import Path6from pathlib import Path
77
8from zaza import model, sync_wrapper8from zaza import model
9from zaza.charm_lifecycle import utils as lifecycle_utils
109
1110
12CHARM_BUILD_DIR = os.environ.get("CHARM_BUILD_DIR", "/tmp/charm-builds")11CHARM_BUILD_DIR = os.environ.get("CHARM_BUILD_DIR", "/tmp/charm-builds")
@@ -39,27 +38,21 @@ async def check_for_inner_status(unit, inner_model, inner_app, target="active"):
39 return False38 return False
4039
4140
42async def async_block_until_inner_app(unit, inner_model, app):41def block_until_inner_app(unit, inner_model, app):
43 """Wait for app to be active."""42 """Wait for app to be active."""
44 await model.async_block_until(43 model.block_until(
45 lambda: check_for_inner_status(unit, inner_model, app),44 lambda: check_for_inner_status(unit, inner_model, app),
46 timeout=600,45 timeout=600,
47 wait_period=2,46 wait_period=2,
48 )47 )
4948
5049
51block_until_inner_app = sync_wrapper(async_block_until_inner_app)
52
53
54class JujuControllerTestBase(unittest.TestCase):50class JujuControllerTestBase(unittest.TestCase):
55 """Base class for charm functional tests."""51 """Base class for charm functional tests."""
5652
57 @classmethod53 @classmethod
58 def setUpClass(cls):54 def setUpClass(cls):
59 """Set up test environment."""55 """Set up test environment."""
60 cls.model_name = model.get_juju_model()
61 cls.test_config = lifecycle_utils.get_charm_config()
62 model.block_until_all_units_idle()
63 cls.unit = "ubuntu/0"56 cls.unit = "ubuntu/0"
64 cls.enable_ha()57 cls.enable_ha()
65 cls.deploy_juju_controller()58 cls.deploy_juju_controller()
diff --git a/src/tox.ini b/src/tox.ini
index 24fb13b..b16ed99 100644
--- a/src/tox.ini
+++ b/src/tox.ini
@@ -69,3 +69,5 @@ deps = -r{toxinidir}/tests/unit/requirements.txt
69changedir = {toxinidir}/tests/functional69changedir = {toxinidir}/tests/functional
70commands = functest-run-suite {posargs}70commands = functest-run-suite {posargs}
71deps = -r{toxinidir}/tests/functional/requirements.txt71deps = -r{toxinidir}/tests/functional/requirements.txt
72setenv =
73 TEST_REPO_ROOT = {toxinidir}/..

Subscribers

People subscribed via source and target branches

to all changes: