Merge ~raychan96/charm-nrpe:juju-3.1 into charm-nrpe:master

Proposed by Chi Wai CHAN
Status: Merged
Approved by: Tianqi Xiao
Approved revision: 57808a907578c88b11e101f087a066ce1ca4bbf6
Merged at revision: 9650ee6407843a434395ce9ef11e2371e01d73bc
Proposed branch: ~raychan96/charm-nrpe:juju-3.1
Merge into: charm-nrpe:master
Diff against target: 167 lines (+19/-9)
7 files modified
charmcraft.yaml (+0/-4)
dev/null (+0/-1)
metadata.yaml (+0/-1)
mod/charmhelpers (+1/-1)
tests/functional/requirements.txt (+1/-1)
tests/functional/tests/nrpe_tests.py (+17/-0)
tests/functional/tests/tests.yaml (+0/-1)
Reviewer Review Type Date Requested Status
🤖 prod-jenkaas-bootstack (community) continuous-integration Approve
JamesLin Approve
Eric Chen Approve
Review via email: mp+453273@code.launchpad.net

Commit message

Add juju 3.x support for functional test.

Description of the change

1. Update charmhelpers
2. Update zaza with libjuju 3.1 suppport
3. Add retry for each test case for functional test because rendering NRPE cfg files may take some time
4. Drop xenial support.

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
Eric Chen (eric-chen) wrote :

LGTM

review: Approve
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 :
review: Needs Fixing (continuous-integration)
Revision history for this message
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :
review: Approve (continuous-integration)
Revision history for this message
Tianqi Xiao (txiao) wrote :

Code change LGTM, but can we modify the commit message for dropping xenial? It is confusing because 3.1 also doesn't work with bionic and we are not dropping that. I'm ready to give my +1 after that change.

Revision history for this message
Chi Wai CHAN (raychan96) wrote :

> Code change LGTM, but can we modify the commit message for dropping xenial? It
> is confusing because 3.1 also doesn't work with bionic and we are not dropping
> that. I'm ready to give my +1 after that change.

Thanks, that makes sense -> Done

Revision history for this message
JamesLin (jneo8) wrote :

LGTM

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

Change successfully merged at revision 9650ee6407843a434395ce9ef11e2371e01d73bc

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/charmcraft.yaml b/charmcraft.yaml
2index bda5184..0a23160 100644
3--- a/charmcraft.yaml
4+++ b/charmcraft.yaml
5@@ -34,7 +34,3 @@ bases:
6 channel: "18.04"
7 architectures:
8 - amd64
9- - name: ubuntu
10- channel: "16.04"
11- architectures:
12- - amd64
13diff --git a/metadata.yaml b/metadata.yaml
14index 2ea361b..8dc1dc2 100644
15--- a/metadata.yaml
16+++ b/metadata.yaml
17@@ -31,4 +31,3 @@ series:
18 - jammy
19 - focal
20 - bionic
21- - xenial
22diff --git a/mod/charmhelpers b/mod/charmhelpers
23index 02ee3d1..fb4c776 160000
24--- a/mod/charmhelpers
25+++ b/mod/charmhelpers
26@@ -1 +1 @@
27-Subproject commit 02ee3d1cc03424d6ac81efc90f36493486585787
28+Subproject commit fb4c77601caed98e029811dcb7970f5f36d37042
29diff --git a/tests/functional/requirements.txt b/tests/functional/requirements.txt
30index bbe8435..370bd24 100644
31--- a/tests/functional/requirements.txt
32+++ b/tests/functional/requirements.txt
33@@ -1,2 +1,2 @@
34-git+https://github.com/openstack-charmers/zaza.git#egg=zaza
35+git+https://github.com/openstack-charmers/zaza.git@libjuju-3.1#egg=zaza
36 python-openstackclient
37diff --git a/tests/functional/tests/bundles/overlays/xenial.yaml.j2 b/tests/functional/tests/bundles/overlays/xenial.yaml.j2
38deleted file mode 100644
39index b33a5de..0000000
40--- a/tests/functional/tests/bundles/overlays/xenial.yaml.j2
41+++ /dev/null
42@@ -1,4 +0,0 @@
43-series: xenial
44-applications:
45- rabbitmq-server:
46- channel: 3.6/edge
47diff --git a/tests/functional/tests/bundles/xenial.yaml b/tests/functional/tests/bundles/xenial.yaml
48deleted file mode 120000
49index f81f6ff..0000000
50--- a/tests/functional/tests/bundles/xenial.yaml
51+++ /dev/null
52@@ -1 +0,0 @@
53-base.yaml
54\ No newline at end of file
55diff --git a/tests/functional/tests/nrpe_tests.py b/tests/functional/tests/nrpe_tests.py
56index 314ffc0..c6bae28 100644
57--- a/tests/functional/tests/nrpe_tests.py
58+++ b/tests/functional/tests/nrpe_tests.py
59@@ -3,9 +3,16 @@ import logging
60 import pprint
61 import unittest
62
63+import tenacity
64+
65 import yaml
66 import zaza.model as model # noqa I201
67
68+RETRY = tenacity.retry(
69+ wait=tenacity.wait_fixed(5),
70+ stop=tenacity.stop_after_attempt(5),
71+)
72+
73
74 class TestBase(unittest.TestCase):
75 """Base Class for charm functional tests."""
76@@ -25,6 +32,7 @@ class TestBase(unittest.TestCase):
77 class TestNrpe(TestBase):
78 """Class for charm functional tests."""
79
80+ @RETRY
81 def test_01_nrpe_check(self):
82 """Verify nrpe check exists."""
83 logging.debug(
84@@ -62,6 +70,7 @@ class TestNrpe(TestBase):
85 content = result.get("Stdout")
86 self.assertTrue(nrpe_checks[nrpe_check] in content)
87
88+ @RETRY
89 def test_02_enable_swap(self):
90 """Check swap checks are applied."""
91 swap = "-w 40% -c 25%"
92@@ -79,6 +88,7 @@ class TestNrpe(TestBase):
93 content = result.get("Stdout")
94 self.assertTrue(swap in content)
95
96+ @RETRY
97 def test_02_remove_check(self):
98 """Verify swap check is removed."""
99 model.set_application_config(self.application_name, {"swap": ""})
100@@ -87,6 +97,7 @@ class TestNrpe(TestBase):
101 result = model.run_on_unit(self.lead_unit_name, cmd)
102 self.assertTrue(result.get("Code") != 0)
103
104+ @RETRY
105 def test_03_user_monitor(self):
106 """Verify user monitors are applied."""
107 user_monitors = {
108@@ -181,6 +192,7 @@ class TestNrpe(TestBase):
109 content = result.get("Stdout")
110 self.assertTrue(remote_nrpe_checks[nrpe_check] in content)
111
112+ @RETRY
113 def test_04_check_nagios_ip_is_allowed(self):
114 """Verify nagios ip is allowed in nrpe.cfg."""
115 nagios_ip = model.get_app_ips("nagios")[0]
116@@ -195,6 +207,7 @@ class TestNrpe(TestBase):
117 content = result.get("Stdout")
118 self.assertTrue(line in content)
119
120+ @RETRY
121 def test_05_netlinks(self):
122 """Check netlinks checks are applied."""
123 netlinks = "- ens3 mtu:9000 speed:10000"
124@@ -217,6 +230,7 @@ class TestNrpe(TestBase):
125 content = result.get("Stdout")
126 self.assertTrue(line in content)
127
128+ @RETRY
129 def test_06_container_checks(self):
130 """Check that certain checks are enabled on hosts but disabled on containers."""
131 # Enable appropriate config to enable various checks for testing whether they
132@@ -281,6 +295,7 @@ class TestNrpe(TestBase):
133 self._get_set_comparison(expected_host_only_checks, container_checks),
134 )
135
136+ @RETRY
137 def test_07_cronjob_checks(self):
138 """Check that cron job is installed and check enabled."""
139 model.set_application_config(
140@@ -304,6 +319,7 @@ class TestNrpe(TestBase):
141 self._get_set_comparison(expected_cronjobs, cronjobs),
142 )
143
144+ @RETRY
145 def test_08_plugins_copied(self):
146 """Check that NRPE plugins are copied."""
147 plugin_dir = "/usr/local/lib/nagios/plugins"
148@@ -361,6 +377,7 @@ class TestNrpe(TestBase):
149 class TestNrpeActions(TestBase):
150 """Class for charm actions."""
151
152+ @RETRY
153 def test_01_ack_reboot(self):
154 """Test the ack-reboot action."""
155 uptime = (
156diff --git a/tests/functional/tests/tests.yaml b/tests/functional/tests/tests.yaml
157index b476f5a..99c32b0 100644
158--- a/tests/functional/tests/tests.yaml
159+++ b/tests/functional/tests/tests.yaml
160@@ -3,7 +3,6 @@ gate_bundles:
161 - jammy
162 - focal
163 - bionic
164- - xenial
165 smoke_bundles:
166 - focal
167 tests:

Subscribers

People subscribed via source and target branches

to all changes: