Skip to content

Commit 64ecd00

Browse files
authored
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 <abhishek.mrt22@gmail.com>
1 parent ab70108 commit 64ecd00

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

test/integration/smoke/test_host_ping.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,14 @@ def setUp(self, handler=logging.StreamHandler()):
4040
self.services = self.testClient.getParsedTestDataConfig()
4141
self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
4242
self.pod = get_pod(self.apiclient, self.zone.id)
43+
self.original_host_state_map = {}
4344
self.cleanup = []
4445

4546
def tearDown(self):
47+
for host_id in self.original_host_state_map:
48+
state = self.original_host_state_map[host_id]
49+
sql_query = "UPDATE host SET status = '" + state + "' WHERE uuid = '" + host_id + "'"
50+
self.dbConnection.execute(sql_query)
4651
super(TestHostPing, self).tearDown()
4752

4853
def checkHostStateInCloudstack(self, state, host_id):
@@ -92,6 +97,7 @@ def test_01_host_ping_on_alert(self):
9297
self.logger.debug('Hypervisor = {}'.format(host.id))
9398

9499
hostToTest = listHost[0]
100+
self.original_host_state_map[hostToTest.id] = hostToTest.state
95101
sql_query = "UPDATE host SET status = 'Alert' WHERE uuid = '" + hostToTest.id + "'"
96102
self.dbConnection.execute(sql_query)
97103

0 commit comments

Comments
 (0)