Make one agent untouchable in test_agent_management
In test_agent_management some tests depend on one agent to be unmodified which was not guaranteed as some tests updated that agent. The update happened because the update test assumed that neutron will return list of agents in different order. The fix is only to select always different agent for update than the one used for other tests. Change-Id: I7af97ac0ee396d2eb132459d29e938bd5f3de9aa Closes-Bug: #1845330
This commit is contained in:
parent
09ee9e809c
commit
b57453f84c
|
@ -66,10 +66,7 @@ class AgentManagementTestJSON(base.BaseAdminNetworkTest):
|
||||||
@decorators.idempotent_id('68a94a14-1243-46e6-83bf-157627e31556')
|
@decorators.idempotent_id('68a94a14-1243-46e6-83bf-157627e31556')
|
||||||
def test_update_agent_description(self):
|
def test_update_agent_description(self):
|
||||||
agents = self.admin_client.list_agents()['agents']
|
agents = self.admin_client.list_agents()['agents']
|
||||||
try:
|
dyn_agent = self._select_one_agent_for_update(agents)
|
||||||
dyn_agent = agents[1]
|
|
||||||
except IndexError:
|
|
||||||
raise self.skipException("This test requires at least two agents.")
|
|
||||||
|
|
||||||
self.useFixture(tempest_fixtures.LockFixture('agent_description'))
|
self.useFixture(tempest_fixtures.LockFixture('agent_description'))
|
||||||
description = 'description for update agent.'
|
description = 'description for update agent.'
|
||||||
|
@ -86,3 +83,10 @@ class AgentManagementTestJSON(base.BaseAdminNetworkTest):
|
||||||
origin_agent = {'description': description}
|
origin_agent = {'description': description}
|
||||||
self.admin_client.update_agent(agent_id=dyn_agent['id'],
|
self.admin_client.update_agent(agent_id=dyn_agent['id'],
|
||||||
agent_info=origin_agent)
|
agent_info=origin_agent)
|
||||||
|
|
||||||
|
def _select_one_agent_for_update(self, agents):
|
||||||
|
"""Return one agent that is not the one selected at resource_setup"""
|
||||||
|
for agent in agents:
|
||||||
|
if self.agent['id'] != agent['id']:
|
||||||
|
return agent
|
||||||
|
raise self.skipException("This test requires at least two agents.")
|
||||||
|
|
Loading…
Reference in New Issue