test_list_agent: pop 'alive' from agent dict

As the test class lists agents in resource setup it can happen that the
selected agent from the list is not 'alive', but when test
test_list_agent lists again the agents, it is already up and
'alive'=True.
To avoid such failure, do skip 'alive' field of the comparison.

Change-Id: I0ed012ef59550e853a30e2994a1ab53083d8640c
Closes-Bug: #1953480
This commit is contained in:
elajkat 2021-12-07 18:40:38 +01:00 committed by Lajos Katona
parent c75ba5028f
commit 7914c98038

View File

@ -38,9 +38,13 @@ class AgentManagementTestJSON(base.BaseAdminNetworkTest):
# Heartbeats must be excluded from comparison
self.agent.pop('heartbeat_timestamp', None)
self.agent.pop('configurations', None)
# Exclude alive as it can happen that when testclass'
# resource_setup executed the selected agent is not up
self.agent.pop('alive', None)
for agent in agents:
agent.pop('heartbeat_timestamp', None)
agent.pop('configurations', None)
agent.pop('alive', None)
self.assertIn(self.agent, agents)
@decorators.idempotent_id('e335be47-b9a1-46fd-be30-0874c0b751e6')