[lxc-devel] [pylxd/branch-2.0] Fix branch-2.0 integration tests

ajkavanagh on Github lxc-bot at linuxcontainers.org
Tue Mar 13 16:27:00 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 590 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180313/b980aae1/attachment.bin>
-------------- next part --------------
From b426fb1005a7bbf13ce6ff7f4e2f3be1cbb8bc59 Mon Sep 17 00:00:00 2001
From: Alex Kavanagh <alex at ajkavanagh.co.uk>
Date: Tue, 13 Mar 2018 16:16:26 +0000
Subject: [PATCH] Fix branch-2.0 integration tests

The integration tests in the integrations/ sub-folder has bit-rotted.
This patch brings them up to date so that they work with the branch-2.0
current.  This is for SRU testing for xenial, which the branch-2.0
tracks releases for.

Signed-off-by: Alex Kavanagh <alex at ajkavanagh.co.uk>
---
 integration/test_containers.py | 7 +++----
 integration/test_images.py     | 7 +++----
 integration/test_profiles.py   | 6 +++---
 3 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/integration/test_containers.py b/integration/test_containers.py
index 4e1f552..ab86b47 100644
--- a/integration/test_containers.py
+++ b/integration/test_containers.py
@@ -71,7 +71,7 @@ def tearDown(self):
     def test_update(self):
         """The container is updated to a new config."""
         self.container.config['limits.cpu'] = '1'
-        self.container.update(wait=True)
+        self.container.save(wait=True)
 
         self.assertEqual('1', self.container.config['limits.cpu'])
         container = self.client.containers.get(self.container.name)
@@ -90,9 +90,8 @@ def test_delete(self):
         """The container is deleted."""
         self.container.delete(wait=True)
 
-        self.assertRaises(
-            exceptions.NotFound,
-            self.client.containers.get, self.container.name)
+        with self.assertRaises(exceptions.LXDAPIException):
+            self.client.containers.get(self.container.name)
 
     def test_start_stop(self):
         """The container is started and then stopped."""
diff --git a/integration/test_images.py b/integration/test_images.py
index a6ee5a9..a96689b 100644
--- a/integration/test_images.py
+++ b/integration/test_images.py
@@ -71,7 +71,7 @@ def test_update(self):
         """The image properties are updated."""
         description = 'an description'
         self.image.properties['description'] = description
-        self.image.update()
+        self.image.save()
 
         image = self.client.images.get(self.image.fingerprint)
         self.assertEqual(description, image.properties['description'])
@@ -80,9 +80,8 @@ def test_delete(self):
         """The image is deleted."""
         self.image.delete(wait=True)
 
-        self.assertRaises(
-            exceptions.NotFound,
-            self.client.images.get, self.image.fingerprint)
+        with self.assertRaises(exceptions.LXDAPIException):
+            self.client.images.get(self.image.fingerprint)
 
     def test_export(self):
         """The imerage is successfully exported."""
diff --git a/integration/test_profiles.py b/integration/test_profiles.py
index 5055504..99f034a 100644
--- a/integration/test_profiles.py
+++ b/integration/test_profiles.py
@@ -65,7 +65,7 @@ def tearDown(self):
     def test_update(self):
         """A profile is updated."""
         self.profile.config['limits.memory'] = '16GB'
-        self.profile.update()
+        self.profile.save()
 
         profile = self.client.profiles.get(self.profile.name)
         self.assertEqual('16GB', profile.config['limits.memory'])
@@ -85,5 +85,5 @@ def test_delete(self):
         """A profile is deleted."""
         self.profile.delete()
 
-        self.assertRaises(
-            exceptions.NotFound, self.client.profiles.get, self.profile.name)
+        with self.assertRaises(exceptions.LXDAPIException):
+            self.client.profiles.get(self.profile.name)


More information about the lxc-devel mailing list