From 4d6921f0dd6e4b45be29fab2eb20b933b1bfc14c Mon Sep 17 00:00:00 2001 From: vponomaryov Date: Wed, 4 Jun 2014 12:01:15 +0300 Subject: [PATCH] Several fixies to tempest plugin 1) Removed redundant two exceptions 2) fixed replacement in exception 3) fixed share_server tests asserts of updated_at field, that is not always set on read moment Change-Id: Idc30de1d83bdf4aacacd666b5ad669c0184d22ed --- .../tempest/api/share/admin/test_share_servers.py | 15 ++++++++++----- contrib/tempest/tempest/share_exceptions.py | 10 +--------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/contrib/tempest/tempest/api/share/admin/test_share_servers.py b/contrib/tempest/tempest/api/share/admin/test_share_servers.py index ed01ab573b..cad3451d77 100644 --- a/contrib/tempest/tempest/api/share/admin/test_share_servers.py +++ b/contrib/tempest/tempest/api/share/admin/test_share_servers.py @@ -61,8 +61,9 @@ class ShareServersAdminTest(base.BaseSharesAdminTest): # All expected keys are present for key in keys: self.assertIn(key, server.keys()) - # 'Updated at' is valid date - self.assertTrue(self.date_re.match(server["updated_at"])) + # 'Updated at' is valid date if set + if server["updated_at"]: + self.assertTrue(self.date_re.match(server["updated_at"])) # Host is not empty self.assertTrue(len(server["host"]) > 0) # Id is not empty @@ -71,8 +72,11 @@ class ShareServersAdminTest(base.BaseSharesAdminTest): self.assertTrue(len(server["project_id"]) > 0) # Server we used is present + # allow 'creating' status too, because there can be + # another server with same requirements. any((s["share_network_name"] in self.sn_name_and_id and - self.assertEqual(s["status"].lower(), "active")) for s in servers) + self.assertIn(s["status"].lower(), + ["active", "creating"])) for s in servers) @test.attr(type=["gate", "smoke", ]) def test_list_share_servers_with_host_filter(self): @@ -176,8 +180,9 @@ class ShareServersAdminTest(base.BaseSharesAdminTest): self.assertIn(key, server.keys()) # 'created_at' is valid date self.assertTrue(self.date_re.match(server["created_at"])) - # 'updated_at' is valid date - self.assertTrue(self.date_re.match(server["updated_at"])) + # 'updated_at' is valid date if set + if server["updated_at"]: + self.assertTrue(self.date_re.match(server["updated_at"])) # Host is not empty self.assertTrue(len(server["host"]) > 0) # Id is not empty diff --git a/contrib/tempest/tempest/share_exceptions.py b/contrib/tempest/tempest/share_exceptions.py index f015b87bf4..19b9fe66e8 100644 --- a/contrib/tempest/tempest/share_exceptions.py +++ b/contrib/tempest/tempest/share_exceptions.py @@ -21,7 +21,7 @@ class ShareBuildErrorException(exceptions.TempestException): class AccessRuleBuildErrorException(exceptions.TempestException): - message = "Share's rule with id %(rule_id) is in ERROR status" + message = "Share's rule with id %(rule_id)s is in ERROR status" class SnapshotBuildErrorException(exceptions.TempestException): @@ -42,11 +42,3 @@ class NoAvailableNetwork(exceptions.TempestException): class InvalidResource(exceptions.TempestException): message = "Provided invalid resource: %(message)s" - - -class ShareNetworkActivationFailed(exceptions.TempestException): - message = "Share-network with id %(sn_id)s failed to activate" - - -class ShareNetworkDeactivationFailed(exceptions.TempestException): - message = "Share-network with id %(sn_id)s failed to deactivate"