Merge ~barryprice/charm-canonical-livepatch/+git/canonical-livepatch-charm:multiseries-testing into ~livepatch-charmers/charm-canonical-livepatch:master

Proposed by Barry Price
Status: Work in progress
Proposed branch: ~barryprice/charm-canonical-livepatch/+git/canonical-livepatch-charm:multiseries-testing
Merge into: ~livepatch-charmers/charm-canonical-livepatch:master
Diff against target: 139 lines (+26/-21)
1 file modified
tests/multiseries (+26/-21)
Reviewer Review Type Date Requested Status
Livepatch charm developers Pending
Review via email: mp+358136@code.launchpad.net

Commit message

First attempt at multi-series testing

To post a comment you must log in.

Unmerged commits

45c714c... by Barry Price

First attempt at multi-series testing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/tests/99-autogen b/tests/multiseries
2index d7bed72..41d46a1 100755
3--- a/tests/99-autogen
4+++ b/tests/multiseries
5@@ -7,38 +7,41 @@ from yaml import safe_load
6
7
8 class TestDeployment(unittest.TestCase):
9+
10+ series = 'bionic' # latest LTS
11+
12 @classmethod
13 def setUpClass(cls):
14- cls.deployment = amulet.Deployment(series='bionic')
15+ cls.deployment = amulet.Deployment(series=series)
16
17 # deploy mongodb as our parent
18- cls.deployment.add('mongodb')
19+ cls.deployment.add('mongodb-{}'.format(series), 'mongodb')
20
21 # deploy our own charm
22- cls.deployment.add('canonical-livepatch')
23+ cls.deployment.add('livepatch-{}'.format(series), 'canonical-livepatch')
24
25 # and deploy the nrpe subordinate to test nagios checks
26- cls.deployment.add('nrpe')
27+ cls.deployment.add('nrpe-{}'.format(series), 'nrpe')
28
29 # set nrpe to export its definitions
30- cls.deployment.configure('nrpe', {
31+ cls.deployment.configure('nrpe-{}'.format(series), {
32 'export_nagios_definitions': True,
33 })
34
35 # relate subordinates to parent charm
36 cls.deployment.relate(
37- 'mongodb:juju-info',
38- 'canonical-livepatch:juju-info'
39+ 'mongodb-{}:juju-info'.format(series),
40+ 'livepatch-{}:juju-info'.format(series)
41 )
42 cls.deployment.relate(
43- 'mongodb:nrpe-external-master',
44- 'nrpe:nrpe-external-master'
45+ 'mongodb-{}:nrpe-external-master'.format(series),
46+ 'nrpe-{}:nrpe-external-master'.format(series)
47 )
48
49 # relate livepatch to nrpe for its own nagios checks
50 cls.deployment.relate(
51- 'canonical-livepatch:nrpe-external-master',
52- 'nrpe:nrpe-external-master'
53+ 'livepatch-{}:nrpe-external-master'.format(series),
54+ 'nrpe-{}:nrpe-external-master'.format(series)
55 )
56
57 try:
58@@ -51,7 +54,7 @@ class TestDeployment(unittest.TestCase):
59 )
60
61 def test_install(self):
62- livepatch = self.deployment.sentry['canonical-livepatch'][0]
63+ livepatch = self.deployment.sentry['livepatch-{}'.format(series)][0]
64
65 # verify the snap was installed
66 output, exit_code = livepatch.run(
67@@ -60,14 +63,14 @@ class TestDeployment(unittest.TestCase):
68 self.assertEqual(exit_code, 0)
69
70 def test_status(self):
71- livepatch = self.deployment.sentry['canonical-livepatch'][0]
72+ livepatch = self.deployment.sentry['livepatch-{}'.format(series)][0]
73
74 # run a status check - we expect this to return 1 due to no access key
75 output, exit_code = livepatch.run('sudo canonical-livepatch status')
76 self.assertEqual(exit_code, 1)
77
78 def test_nagios_init(self):
79- livepatch = self.deployment.sentry['canonical-livepatch'][0]
80+ livepatch = self.deployment.sentry['livepatch-{}'.format(series)][0]
81
82 # check for nagios bits
83 for path in [
84@@ -79,12 +82,12 @@ class TestDeployment(unittest.TestCase):
85 self.assertEqual(exit_code, 0)
86
87 def test_nagios_context_change(self):
88- livepatch = self.deployment.sentry['canonical-livepatch'][0]
89+ livepatch = self.deployment.sentry['livepatch-{}'.format(series)][0]
90
91 test_context_name = 'amulet1'
92
93 # set context name
94- self.deployment.configure('canonical-livepatch', {
95+ self.deployment.configure('livepatch-{}'.format(series), {
96 'nagios_context': test_context_name,
97 })
98
99@@ -99,7 +102,7 @@ class TestDeployment(unittest.TestCase):
100 self.assertEqual(exit_code, 0)
101
102 def test_channel_change(self):
103- livepatch = self.deployment.sentry['canonical-livepatch'][0]
104+ livepatch = self.deployment.sentry['livepatch-{}'.format(series)][0]
105
106 # verify the current channel
107 output, exit_code = livepatch.run('snap info canonical-livepatch')
108@@ -111,7 +114,7 @@ class TestDeployment(unittest.TestCase):
109 self.assertEqual(channel, 'stable')
110
111 # change channel to 'beta'
112- self.deployment.configure('canonical-livepatch', {
113+ self.deployment.configure('livepatch-{}'.format(series), {
114 'snap_channel': 'beta',
115 })
116
117@@ -128,12 +131,12 @@ class TestDeployment(unittest.TestCase):
118 self.assertEqual(channel, 'beta')
119
120 def test_nagios_servicegroup_change(self):
121- livepatch = self.deployment.sentry['canonical-livepatch'][0]
122+ livepatch = self.deployment.sentry['livepatch-{}'.format(series)][0]
123
124 test_servicegroup_name = 'amulet2'
125
126 # set servicegroup name
127- self.deployment.configure('canonical-livepatch', {
128+ self.deployment.configure('livepatch-{}'.format(series), {
129 'nagios_servicegroups': test_servicegroup_name,
130 })
131
132@@ -150,4 +153,6 @@ class TestDeployment(unittest.TestCase):
133
134
135 if __name__ == '__main__':
136- unittest.main()
137+ for series in ['trusty', 'xenial', 'bionic']:
138+ TestDeployment.series = series
139+ unittest.main()

Subscribers

People subscribed via source and target branches