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
diff --git a/charmcraft.yaml b/charmcraft.yaml
index bda5184..0a23160 100644
--- a/charmcraft.yaml
+++ b/charmcraft.yaml
@@ -34,7 +34,3 @@ bases:
34 channel: "18.04"34 channel: "18.04"
35 architectures:35 architectures:
36 - amd6436 - amd64
37 - name: ubuntu
38 channel: "16.04"
39 architectures:
40 - amd64
diff --git a/metadata.yaml b/metadata.yaml
index 2ea361b..8dc1dc2 100644
--- a/metadata.yaml
+++ b/metadata.yaml
@@ -31,4 +31,3 @@ series:
31 - jammy31 - jammy
32 - focal32 - focal
33 - bionic33 - bionic
34 - xenial
diff --git a/mod/charmhelpers b/mod/charmhelpers
index 02ee3d1..fb4c776 160000
--- a/mod/charmhelpers
+++ b/mod/charmhelpers
@@ -1 +1 @@
1Subproject commit 02ee3d1cc03424d6ac81efc90f364934865857871Subproject commit fb4c77601caed98e029811dcb7970f5f36d37042
diff --git a/tests/functional/requirements.txt b/tests/functional/requirements.txt
index bbe8435..370bd24 100644
--- a/tests/functional/requirements.txt
+++ b/tests/functional/requirements.txt
@@ -1,2 +1,2 @@
1git+https://github.com/openstack-charmers/zaza.git#egg=zaza1git+https://github.com/openstack-charmers/zaza.git@libjuju-3.1#egg=zaza
2python-openstackclient2python-openstackclient
diff --git a/tests/functional/tests/bundles/overlays/xenial.yaml.j2 b/tests/functional/tests/bundles/overlays/xenial.yaml.j2
3deleted file mode 1006443deleted file mode 100644
index b33a5de..0000000
--- a/tests/functional/tests/bundles/overlays/xenial.yaml.j2
+++ /dev/null
@@ -1,4 +0,0 @@
1series: xenial
2applications:
3 rabbitmq-server:
4 channel: 3.6/edge
diff --git a/tests/functional/tests/bundles/xenial.yaml b/tests/functional/tests/bundles/xenial.yaml
5deleted file mode 1200000deleted file mode 120000
index f81f6ff..0000000
--- a/tests/functional/tests/bundles/xenial.yaml
+++ /dev/null
@@ -1 +0,0 @@
1base.yaml
2\ No newline at end of file0\ No newline at end of file
diff --git a/tests/functional/tests/nrpe_tests.py b/tests/functional/tests/nrpe_tests.py
index 314ffc0..c6bae28 100644
--- a/tests/functional/tests/nrpe_tests.py
+++ b/tests/functional/tests/nrpe_tests.py
@@ -3,9 +3,16 @@ import logging
3import pprint3import pprint
4import unittest4import unittest
55
6import tenacity
7
6import yaml8import yaml
7import zaza.model as model # noqa I2019import zaza.model as model # noqa I201
810
11RETRY = tenacity.retry(
12 wait=tenacity.wait_fixed(5),
13 stop=tenacity.stop_after_attempt(5),
14)
15
916
10class TestBase(unittest.TestCase):17class TestBase(unittest.TestCase):
11 """Base Class for charm functional tests."""18 """Base Class for charm functional tests."""
@@ -25,6 +32,7 @@ class TestBase(unittest.TestCase):
25class TestNrpe(TestBase):32class TestNrpe(TestBase):
26 """Class for charm functional tests."""33 """Class for charm functional tests."""
2734
35 @RETRY
28 def test_01_nrpe_check(self):36 def test_01_nrpe_check(self):
29 """Verify nrpe check exists."""37 """Verify nrpe check exists."""
30 logging.debug(38 logging.debug(
@@ -62,6 +70,7 @@ class TestNrpe(TestBase):
62 content = result.get("Stdout")70 content = result.get("Stdout")
63 self.assertTrue(nrpe_checks[nrpe_check] in content)71 self.assertTrue(nrpe_checks[nrpe_check] in content)
6472
73 @RETRY
65 def test_02_enable_swap(self):74 def test_02_enable_swap(self):
66 """Check swap checks are applied."""75 """Check swap checks are applied."""
67 swap = "-w 40% -c 25%"76 swap = "-w 40% -c 25%"
@@ -79,6 +88,7 @@ class TestNrpe(TestBase):
79 content = result.get("Stdout")88 content = result.get("Stdout")
80 self.assertTrue(swap in content)89 self.assertTrue(swap in content)
8190
91 @RETRY
82 def test_02_remove_check(self):92 def test_02_remove_check(self):
83 """Verify swap check is removed."""93 """Verify swap check is removed."""
84 model.set_application_config(self.application_name, {"swap": ""})94 model.set_application_config(self.application_name, {"swap": ""})
@@ -87,6 +97,7 @@ class TestNrpe(TestBase):
87 result = model.run_on_unit(self.lead_unit_name, cmd)97 result = model.run_on_unit(self.lead_unit_name, cmd)
88 self.assertTrue(result.get("Code") != 0)98 self.assertTrue(result.get("Code") != 0)
8999
100 @RETRY
90 def test_03_user_monitor(self):101 def test_03_user_monitor(self):
91 """Verify user monitors are applied."""102 """Verify user monitors are applied."""
92 user_monitors = {103 user_monitors = {
@@ -181,6 +192,7 @@ class TestNrpe(TestBase):
181 content = result.get("Stdout")192 content = result.get("Stdout")
182 self.assertTrue(remote_nrpe_checks[nrpe_check] in content)193 self.assertTrue(remote_nrpe_checks[nrpe_check] in content)
183194
195 @RETRY
184 def test_04_check_nagios_ip_is_allowed(self):196 def test_04_check_nagios_ip_is_allowed(self):
185 """Verify nagios ip is allowed in nrpe.cfg."""197 """Verify nagios ip is allowed in nrpe.cfg."""
186 nagios_ip = model.get_app_ips("nagios")[0]198 nagios_ip = model.get_app_ips("nagios")[0]
@@ -195,6 +207,7 @@ class TestNrpe(TestBase):
195 content = result.get("Stdout")207 content = result.get("Stdout")
196 self.assertTrue(line in content)208 self.assertTrue(line in content)
197209
210 @RETRY
198 def test_05_netlinks(self):211 def test_05_netlinks(self):
199 """Check netlinks checks are applied."""212 """Check netlinks checks are applied."""
200 netlinks = "- ens3 mtu:9000 speed:10000"213 netlinks = "- ens3 mtu:9000 speed:10000"
@@ -217,6 +230,7 @@ class TestNrpe(TestBase):
217 content = result.get("Stdout")230 content = result.get("Stdout")
218 self.assertTrue(line in content)231 self.assertTrue(line in content)
219232
233 @RETRY
220 def test_06_container_checks(self):234 def test_06_container_checks(self):
221 """Check that certain checks are enabled on hosts but disabled on containers."""235 """Check that certain checks are enabled on hosts but disabled on containers."""
222 # Enable appropriate config to enable various checks for testing whether they236 # Enable appropriate config to enable various checks for testing whether they
@@ -281,6 +295,7 @@ class TestNrpe(TestBase):
281 self._get_set_comparison(expected_host_only_checks, container_checks),295 self._get_set_comparison(expected_host_only_checks, container_checks),
282 )296 )
283297
298 @RETRY
284 def test_07_cronjob_checks(self):299 def test_07_cronjob_checks(self):
285 """Check that cron job is installed and check enabled."""300 """Check that cron job is installed and check enabled."""
286 model.set_application_config(301 model.set_application_config(
@@ -304,6 +319,7 @@ class TestNrpe(TestBase):
304 self._get_set_comparison(expected_cronjobs, cronjobs),319 self._get_set_comparison(expected_cronjobs, cronjobs),
305 )320 )
306321
322 @RETRY
307 def test_08_plugins_copied(self):323 def test_08_plugins_copied(self):
308 """Check that NRPE plugins are copied."""324 """Check that NRPE plugins are copied."""
309 plugin_dir = "/usr/local/lib/nagios/plugins"325 plugin_dir = "/usr/local/lib/nagios/plugins"
@@ -361,6 +377,7 @@ class TestNrpe(TestBase):
361class TestNrpeActions(TestBase):377class TestNrpeActions(TestBase):
362 """Class for charm actions."""378 """Class for charm actions."""
363379
380 @RETRY
364 def test_01_ack_reboot(self):381 def test_01_ack_reboot(self):
365 """Test the ack-reboot action."""382 """Test the ack-reboot action."""
366 uptime = (383 uptime = (
diff --git a/tests/functional/tests/tests.yaml b/tests/functional/tests/tests.yaml
index b476f5a..99c32b0 100644
--- a/tests/functional/tests/tests.yaml
+++ b/tests/functional/tests/tests.yaml
@@ -3,7 +3,6 @@ gate_bundles:
3 - jammy3 - jammy
4 - focal4 - focal
5 - bionic5 - bionic
6 - xenial
7smoke_bundles:6smoke_bundles:
8 - focal7 - focal
9tests:8tests:

Subscribers

People subscribed via source and target branches

to all changes: