Merge "[Fullstack] Remove dhcp agent in tests where it isn't necessary"

This commit is contained in:
Zuul 2022-03-24 19:37:52 +00:00 committed by Gerrit Code Review
commit 1473adca5d
6 changed files with 14 additions and 29 deletions

View File

@ -172,6 +172,8 @@ class BaseFullStackTestCase(testlib_api.MySQLTestCaseMixin,
for host in self.environment.hosts) for host in self.environment.hosts)
vms.block_until_all_boot() vms.block_until_all_boot()
if use_dhcp:
vms.block_until_all_dhcp_config_done()
return vms return vms
def assert_namespace_exists(self, ns_name): def assert_namespace_exists(self, ns_name):

View File

@ -38,6 +38,10 @@ class FakeFullstackMachinesList(list):
for vm in self: for vm in self:
vm.block_until_boot() vm.block_until_boot()
def block_until_all_dhcp_config_done(self):
for vm in self:
vm.block_until_dhcp_config_done()
def ping_all(self): def ping_all(self):
# Generate an iterable of all unique pairs. For example: # Generate an iterable of all unique pairs. For example:
# itertools.permutations(range(3), 2) results in: # itertools.permutations(range(3), 2) results in:

View File

@ -37,7 +37,7 @@ LOG = logging.getLogger(__name__)
class BaseConnectivitySameNetworkTest(base.BaseFullStackTestCase): class BaseConnectivitySameNetworkTest(base.BaseFullStackTestCase):
arp_responder = False arp_responder = False
use_dhcp = True use_dhcp = False
num_hosts = 3 num_hosts = 3
@ -166,23 +166,6 @@ class TestLinuxBridgeConnectivitySameNetwork(BaseConnectivitySameNetworkTest):
self._test_connectivity() self._test_connectivity()
class TestConnectivitySameNetworkNoDhcp(BaseConnectivitySameNetworkTest):
scenarios = [
(constants.AGENT_TYPE_OVS,
{'l2_agent_type': constants.AGENT_TYPE_OVS}),
(constants.AGENT_TYPE_LINUXBRIDGE,
{'l2_agent_type': constants.AGENT_TYPE_LINUXBRIDGE})
]
use_dhcp = False
network_type = 'vxlan'
l2_pop = False
def test_connectivity(self):
self._test_connectivity()
class _TestUninterruptedConnectivityOnL2AgentRestart( class _TestUninterruptedConnectivityOnL2AgentRestart(
BaseConnectivitySameNetworkTest): BaseConnectivitySameNetworkTest):

View File

@ -72,6 +72,7 @@ class BaseDhcpAgentTest(base.BaseFullStackTestCase):
self.safe_client, self.safe_client,
use_dhcp=True)) use_dhcp=True))
vm.block_until_boot() vm.block_until_boot()
vm.block_until_dhcp_config_done()
return vm return vm
def _create_network_subnet_and_vm(self): def _create_network_subnet_and_vm(self):
@ -181,8 +182,7 @@ class TestDhcpAgentHA(BaseDhcpAgentTest):
self.assertEqual(1, len(new_network_dhcp_agents)) self.assertEqual(1, len(new_network_dhcp_agents))
# check if new vm will get IP from new DHCP agent # check if new vm will get IP from new DHCP agent
new_vm = self._spawn_vm() self._spawn_vm()
new_vm.block_until_dhcp_config_done()
def test_multiple_agents_for_network(self): def test_multiple_agents_for_network(self):
network_dhcp_agents = self.client.list_dhcp_agent_hosting_networks( network_dhcp_agents = self.client.list_dhcp_agent_hosting_networks(
@ -198,8 +198,7 @@ class TestDhcpAgentHA(BaseDhcpAgentTest):
self._kill_dhcp_agent(network_dhcp_agents[0]) self._kill_dhcp_agent(network_dhcp_agents[0])
# check if new vm will get IP from DHCP agent which is still alive # check if new vm will get IP from DHCP agent which is still alive
new_vm = self._spawn_vm() self._spawn_vm()
new_vm.block_until_dhcp_config_done()
class TestDhcpAgentHARaceCondition(BaseDhcpAgentTest): class TestDhcpAgentHARaceCondition(BaseDhcpAgentTest):
@ -300,8 +299,6 @@ class TestSubnetDeleteRace(BaseDhcpAgentTest):
enable_dhcp=True) enable_dhcp=True)
self.vm = self._spawn_vm() self.vm = self._spawn_vm()
self.vm.block_until_boot()
self.vm.block_until_dhcp_config_done()
dhcp_ports = self.safe_client.list_ports(**{ dhcp_ports = self.safe_client.list_ports(**{
'device_owner': 'network:dhcp', 'device_owner': 'network:dhcp',

View File

@ -163,6 +163,7 @@ class OvsDHCPExtensionTestCase(base.BaseFullStackTestCase):
def test_ovs_dhcp_agent_extension_ping_vms(self): def test_ovs_dhcp_agent_extension_ping_vms(self):
vms = self._prepare_vms() vms = self._prepare_vms()
vms.block_until_all_boot() vms.block_until_all_boot()
vms.block_until_all_dhcp_config_done()
# ping -4 from vm_1 to vm_2 # ping -4 from vm_1 to vm_2
vms.ping_all() vms.ping_all()
# ping -6 from vm_1 to vm_2 # ping -6 from vm_1 to vm_2

View File

@ -52,7 +52,7 @@ class BaseSecurityGroupsSameNetworkTest(base.BaseFullStackTestCase):
environment.HostDescription( environment.HostDescription(
l2_agent_type=self.l2_agent_type, l2_agent_type=self.l2_agent_type,
firewall_driver=self.firewall_driver, firewall_driver=self.firewall_driver,
dhcp_agent=True) for _ in range(self.num_hosts)] dhcp_agent=False) for _ in range(self.num_hosts)]
env = environment.Environment( env = environment.Environment(
environment.EnvironmentDescription( environment.EnvironmentDescription(
network_type=self.network_type, network_type=self.network_type,
@ -246,11 +246,10 @@ class TestSecurityGroupsSameNetwork(BaseSecurityGroupsSameNetworkTest):
tenant_uuid, tenant_uuid,
self.safe_client, self.safe_client,
neutron_port=ports[-1], neutron_port=ports[-1],
use_dhcp=True))) use_dhcp=False)))
self.assertEqual(5, len(vms)) self.assertEqual(5, len(vms))
vms[4].block_until_boot() vms[4].block_until_boot()
vms[4].block_until_dhcp_config_done()
netcat = net_helpers.NetcatTester(vms[4].namespace, netcat = net_helpers.NetcatTester(vms[4].namespace,
vms[0].namespace, vms[0].ip, 3355, vms[0].namespace, vms[0].ip, 3355,
@ -566,10 +565,9 @@ class TestSecurityGroupsSameNetwork(BaseSecurityGroupsSameNetworkTest):
tenant_uuid, tenant_uuid,
self.safe_client, self.safe_client,
neutron_port=ports[port], neutron_port=ports[port],
use_dhcp=True)) use_dhcp=False))
for port, host in enumerate(index_to_host)] for port, host in enumerate(index_to_host)]
map(lambda vm: vm.block_until_boot(), vms) map(lambda vm: vm.block_until_boot(), vms)
map(lambda vm: vm.block_until_dhcp_config_done(), vms)
return vms, ports, sgs, network, index_to_host return vms, ports, sgs, network, index_to_host