This is an automated email from the ASF dual-hosted git repository.
shwstppr pushed a commit to branch 4.18
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/4.18 by this push:
new 64ecd00eb70 test: fix test_host_ping.py to restore original host state
(#8380)
64ecd00eb70 is described below
commit 64ecd00eb70531d177031b50e5c15f73668df6e8
Author: Abhishek Kumar <[email protected]>
AuthorDate: Wed Dec 20 11:52:08 2023 +0530
test: fix test_host_ping.py to restore original host state (#8380)
Failures seen in #7344 were debugged and it was seen since one of the
host is in Alert state. VM deployment fails with affinity group.
Signed-off-by: Abhishek Kumar <[email protected]>
---
test/integration/smoke/test_host_ping.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/test/integration/smoke/test_host_ping.py
b/test/integration/smoke/test_host_ping.py
index 9de77f9b771..6414553543a 100644
--- a/test/integration/smoke/test_host_ping.py
+++ b/test/integration/smoke/test_host_ping.py
@@ -40,9 +40,14 @@ class TestHostPing(cloudstackTestCase):
self.services = self.testClient.getParsedTestDataConfig()
self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
self.pod = get_pod(self.apiclient, self.zone.id)
+ self.original_host_state_map = {}
self.cleanup = []
def tearDown(self):
+ for host_id in self.original_host_state_map:
+ state = self.original_host_state_map[host_id]
+ sql_query = "UPDATE host SET status = '" + state + "' WHERE uuid =
'" + host_id + "'"
+ self.dbConnection.execute(sql_query)
super(TestHostPing, self).tearDown()
def checkHostStateInCloudstack(self, state, host_id):
@@ -92,6 +97,7 @@ class TestHostPing(cloudstackTestCase):
self.logger.debug('Hypervisor = {}'.format(host.id))
hostToTest = listHost[0]
+ self.original_host_state_map[hostToTest.id] = hostToTest.state
sql_query = "UPDATE host SET status = 'Alert' WHERE uuid = '" +
hostToTest.id + "'"
self.dbConnection.execute(sql_query)