Merge ~zzehring/charm-juju-controller:bugfix/nrpe-relation-functest-not-series-aware into charm-juju-controller:master

Proposed by Zachary Zehring
Status: Merged
Approved by: James Troup
Approved revision: b3991fa0414765e7f68ab9f5a5db54ea925a84c4
Merged at revision: 57fe32b111aca74d3dbba17683dce66304a4a9b8
Proposed branch: ~zzehring/charm-juju-controller:bugfix/nrpe-relation-functest-not-series-aware
Merge into: charm-juju-controller:master
Diff against target: 55 lines (+21/-4)
2 files modified
src/tests/functional/tests/bundles/base.yaml (+5/-0)
src/tests/functional/tests/tests_juju_controller.py (+16/-4)
Reviewer Review Type Date Requested Status
🤖 prod-jenkaas-bootstack (community) continuous-integration Approve
BootStack Reviewers Pending
BootStack Reviewers Pending
Review via email: mp+410321@code.launchpad.net

Commit message

Fix nrpe relation test thru series awareness.

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: Approve (continuous-integration)
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision 57fe32b111aca74d3dbba17683dce66304a4a9b8

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/base.yaml b/src/tests/functional/tests/bundles/base.yaml
2index d87988f..bdf6f5b 100644
3--- a/src/tests/functional/tests/bundles/base.yaml
4+++ b/src/tests/functional/tests/bundles/base.yaml
5@@ -1,7 +1,12 @@
6 description: "juju-controller charm test bundle"
7+machines:
8+ '0':
9+ constraints: cores=2 mem=2G root-disk=16G
10 applications:
11 ubuntu:
12 num_units: 1
13+ to:
14+ - '0'
15 juju-local:
16 charm: "cs:~bootstack-charmers-next/juju-local"
17 relations:
18diff --git a/src/tests/functional/tests/tests_juju_controller.py b/src/tests/functional/tests/tests_juju_controller.py
19index fd7b048..30325be 100644
20--- a/src/tests/functional/tests/tests_juju_controller.py
21+++ b/src/tests/functional/tests/tests_juju_controller.py
22@@ -5,7 +5,7 @@ import os
23 import unittest
24 from pathlib import Path
25
26-from zaza import model
27+from zaza import model, run
28
29
30 CHARM_BUILD_DIR = os.environ.get("CHARM_BUILD_DIR", "/tmp/charm-builds")
31@@ -114,9 +114,21 @@ class JujuControllerTestBase(unittest.TestCase):
32 class BasicJujucontrollerTest(JujuControllerTestBase):
33 """Class for charm functional tests."""
34
35+ def _get_release_inner_model(self):
36+ juju_status_dict = run(juju_status(self.unit, "controller"))
37+ return juju_status_dict.get("machines").get("0").get("series")
38+
39 def test_nrpe_rel(self):
40 """Check that nrpe check is rendered correctly."""
41- expect = "/usr/local/lib/nagios/plugins/check_systemd.py juju-db"
42+ inner_controller_series = self._get_release_inner_model()
43+ if inner_controller_series == "focal":
44+ expected_content = (
45+ "/usr/local/lib/nagios/plugins/check_systemd.py snap.juju-db.daemon"
46+ )
47+ check_filepath = "/etc/nagios/nrpe.d/check_snap.juju-db.daemon.cfg"
48+ else:
49+ expected_content = "/usr/local/lib/nagios/plugins/check_systemd.py juju-db"
50+ check_filepath = "/etc/nagios/nrpe.d/check_juju-db.cfg"
51 for u in (0, 1, 2):
52- chk = self.remote_cat(u, "/etc/nagios/nrpe.d/check_juju-db.cfg")
53- self.assertTrue(chk.find(expect) != -1)
54+ chk = self.remote_cat(u, check_filepath)
55+ self.assertTrue(chk.find(expected_content) != -1)

Subscribers

People subscribed via source and target branches

to all changes: