From 5babb68031e6e07b5b84db092bd06b8ecc79b464 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Wed, 19 Oct 2016 01:54:44 +0200 Subject: [PATCH] tests/backupcompatibility: verify if all files got restored There is still no verification of disk images content, nor VM properties... --- qubes/tests/int/backupcompatibility.py | 55 +++++++++++++------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/qubes/tests/int/backupcompatibility.py b/qubes/tests/int/backupcompatibility.py index cfede7c6..bb98af23 100644 --- a/qubes/tests/int/backupcompatibility.py +++ b/qubes/tests/int/backupcompatibility.py @@ -405,6 +405,11 @@ class TC_00_BackupCompatibility( output.close() + def assertRestored(self, name): + with self.assertNotRaises((KeyError, qubes.exc.QubesException)): + vm = self.app.domains[name] + vm.storage.verify() + def test_100_r1(self): self.create_v1_files(r2b2=False) @@ -418,12 +423,11 @@ class TC_00_BackupCompatibility( 'use-default-netvm': True, }, ) - with self.assertNotRaises(KeyError): - vm = self.app.domains["test-template-clone"] - vm = self.app.domains["test-testproxy"] - vm = self.app.domains["test-work"] - vm = self.app.domains["test-standalonevm"] - vm = self.app.domains["test-custom-template-appvm"] + self.assertRestored("test-template-clone") + self.assertRestored("test-testproxy") + self.assertRestored("test-work") + self.assertRestored("test-standalonevm") + self.assertRestored("test-custom-template-appvm") self.assertEqual(self.app.domains["test-custom-template-appvm"] .template, self.app.domains["test-template-clone"]) @@ -439,13 +443,12 @@ class TC_00_BackupCompatibility( 'use-default-template': True, 'use-default-netvm': True, }) - with self.assertNotRaises(KeyError): - vm = self.app.domains["test-template-clone"] - vm = self.app.domains["test-testproxy"] - vm = self.app.domains["test-work"] - vm = self.app.domains["test-testhvm"] - vm = self.app.domains["test-standalonevm"] - vm = self.app.domains["test-custom-template-appvm"] + self.assertRestored("test-template-clone") + self.assertRestored("test-testproxy") + self.assertRestored("test-work") + self.assertRestored("test-testhvm") + self.assertRestored("test-standalonevm") + self.assertRestored("test-custom-template-appvm") self.assertEqual(self.app.domains["test-custom-template-appvm"] .template, self.app.domains["test-template-clone"]) @@ -457,13 +460,12 @@ class TC_00_BackupCompatibility( 'use-default-template': True, 'use-default-netvm': True, }) - with self.assertNotRaises(KeyError): - vm = self.app.domains["test-template-clone"] - vm = self.app.domains["test-testproxy"] - vm = self.app.domains["test-work"] - vm = self.app.domains["test-testhvm"] - vm = self.app.domains["test-standalonevm"] - vm = self.app.domains["test-custom-template-appvm"] + self.assertRestored("test-template-clone") + self.assertRestored("test-testproxy") + self.assertRestored("test-work") + self.assertRestored("test-testhvm") + self.assertRestored("test-standalonevm") + self.assertRestored("test-custom-template-appvm") self.assertEqual(self.app.domains["test-custom-template-appvm"] .template, self.app.domains["test-template-clone"]) @@ -475,13 +477,12 @@ class TC_00_BackupCompatibility( 'use-default-template': True, 'use-default-netvm': True, }) - with self.assertNotRaises(KeyError): - vm = self.app.domains["test-template-clone"] - vm = self.app.domains["test-testproxy"] - vm = self.app.domains["test-work"] - vm = self.app.domains["test-testhvm"] - vm = self.app.domains["test-standalonevm"] - vm = self.app.domains["test-custom-template-appvm"] + self.assertRestored("test-template-clone") + self.assertRestored("test-testproxy") + self.assertRestored("test-work") + self.assertRestored("test-testhvm") + self.assertRestored("test-standalonevm") + self.assertRestored("test-custom-template-appvm") self.assertEqual(self.app.domains["test-custom-template-appvm"] .template, self.app.domains["test-template-clone"])