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
This commit is contained in:
vponomaryov 2014-06-04 12:01:15 +03:00
parent 9f65e8fe44
commit 4d6921f0dd
2 changed files with 11 additions and 14 deletions

View File

@ -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

View File

@ -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"