← Back to team overview

livepatch-charmers team mailing list archive

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

 

Barry Price has proposed merging ~barryprice/canonical-livepatch-charm/+git/multiseries-testing:master into canonical-livepatch-charm:master.

Commit message:
Add multiseries testing (currently spuporting Bionic (LTS) and Xenial (LTS-1) - Trusty (LTS-2) is rather more complicated)

Requested reviews:
  Livepatch charm developers (livepatch-charmers)

For more details, see:
https://code.launchpad.net/~barryprice/canonical-livepatch-charm/+git/multiseries-testing/+merge/363797
-- 
Your team Livepatch charm developers is requested to review the proposed merge of ~barryprice/canonical-livepatch-charm/+git/multiseries-testing:master into canonical-livepatch-charm:master.
diff --git a/tests/99-autogen b/tests/multiseries
similarity index 82%
rename from tests/99-autogen
rename to tests/multiseries
index d7bed72..55adc62 100755
--- a/tests/99-autogen
+++ b/tests/multiseries
@@ -7,38 +7,40 @@ from yaml import safe_load
 
 
 class TestDeployment(unittest.TestCase):
+    series = 'bionic'  # latest LTS
+
     @classmethod
     def setUpClass(cls):
-        cls.deployment = amulet.Deployment(series='bionic')
+        cls.deployment = amulet.Deployment(series=cls.series)
 
         # deploy mongodb as our parent
-        cls.deployment.add('mongodb')
+        cls.deployment.add('mongodb-{}'.format(cls.series), 'mongodb')
 
         # deploy our own charm
-        cls.deployment.add('canonical-livepatch')
+        cls.deployment.add('livepatch-{}'.format(cls.series), 'canonical-livepatch')
 
         # and deploy the nrpe subordinate to test nagios checks
-        cls.deployment.add('nrpe')
+        cls.deployment.add('nrpe-{}'.format(cls.series), 'nrpe')
 
         # set nrpe to export its definitions
-        cls.deployment.configure('nrpe', {
+        cls.deployment.configure('nrpe-{}'.format(cls.series), {
             'export_nagios_definitions': True,
         })
 
         # relate subordinates to parent charm
         cls.deployment.relate(
-            'mongodb:juju-info',
-            'canonical-livepatch:juju-info'
+            'mongodb-{}:juju-info'.format(cls.series),
+            'livepatch-{}:juju-info'.format(cls.series)
         )
         cls.deployment.relate(
-            'mongodb:nrpe-external-master',
-            'nrpe:nrpe-external-master'
+            'mongodb-{}:nrpe-external-master'.format(cls.series),
+            'nrpe-{}:nrpe-external-master'.format(cls.series)
         )
 
         # relate livepatch to nrpe for its own nagios checks
         cls.deployment.relate(
-            'canonical-livepatch:nrpe-external-master',
-            'nrpe:nrpe-external-master'
+            'livepatch-{}:nrpe-external-master'.format(cls.series),
+            'nrpe-{}:nrpe-external-master'.format(cls.series)
         )
 
         try:
@@ -51,7 +53,7 @@ class TestDeployment(unittest.TestCase):
             )
 
     def test_install(self):
-        livepatch = self.deployment.sentry['canonical-livepatch'][0]
+        livepatch = self.deployment.sentry['livepatch-{}'.format(self.series)][0]
 
         # verify the snap was installed
         output, exit_code = livepatch.run(
@@ -60,14 +62,14 @@ class TestDeployment(unittest.TestCase):
         self.assertEqual(exit_code, 0)
 
     def test_status(self):
-        livepatch = self.deployment.sentry['canonical-livepatch'][0]
+        livepatch = self.deployment.sentry['livepatch-{}'.format(self.series)][0]
 
         # run a status check - we expect this to return 1 due to no access key
         output, exit_code = livepatch.run('sudo canonical-livepatch status')
         self.assertEqual(exit_code, 1)
 
     def test_nagios_init(self):
-        livepatch = self.deployment.sentry['canonical-livepatch'][0]
+        livepatch = self.deployment.sentry['livepatch-{}'.format(self.series)][0]
 
         # check for nagios bits
         for path in [
@@ -79,12 +81,12 @@ class TestDeployment(unittest.TestCase):
             self.assertEqual(exit_code, 0)
 
     def test_nagios_context_change(self):
-        livepatch = self.deployment.sentry['canonical-livepatch'][0]
+        livepatch = self.deployment.sentry['livepatch-{}'.format(self.series)][0]
 
         test_context_name = 'amulet1'
 
         # set context name
-        self.deployment.configure('canonical-livepatch', {
+        self.deployment.configure('livepatch-{}'.format(self.series), {
             'nagios_context': test_context_name,
         })
 
@@ -99,7 +101,7 @@ class TestDeployment(unittest.TestCase):
         self.assertEqual(exit_code, 0)
 
     def test_channel_change(self):
-        livepatch = self.deployment.sentry['canonical-livepatch'][0]
+        livepatch = self.deployment.sentry['livepatch-{}'.format(self.series)][0]
 
         # verify the current channel
         output, exit_code = livepatch.run('snap info canonical-livepatch')
@@ -111,7 +113,7 @@ class TestDeployment(unittest.TestCase):
         self.assertEqual(channel, 'stable')
 
         # change channel to 'beta'
-        self.deployment.configure('canonical-livepatch', {
+        self.deployment.configure('livepatch-{}'.format(self.series), {
             'snap_channel': 'beta',
         })
 
@@ -128,12 +130,12 @@ class TestDeployment(unittest.TestCase):
         self.assertEqual(channel, 'beta')
 
     def test_nagios_servicegroup_change(self):
-        livepatch = self.deployment.sentry['canonical-livepatch'][0]
+        livepatch = self.deployment.sentry['livepatch-{}'.format(self.series)][0]
 
         test_servicegroup_name = 'amulet2'
 
         # set servicegroup name
-        self.deployment.configure('canonical-livepatch', {
+        self.deployment.configure('livepatch-{}'.format(self.series), {
             'nagios_servicegroups': test_servicegroup_name,
         })
 
@@ -149,5 +151,9 @@ class TestDeployment(unittest.TestCase):
         self.assertEqual(exit_code, 0)
 
 
+class TestXenialDeployment(TestDeployment):
+    series = 'xenial'
+
+
 if __name__ == '__main__':
     unittest.main()

References