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)
vms.block_until_all_boot()
if use_dhcp:
vms.block_until_all_dhcp_config_done()
return vms
def assert_namespace_exists(self, ns_name):

View File

@ -38,6 +38,10 @@ class FakeFullstackMachinesList(list):
for vm in self:
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):
# Generate an iterable of all unique pairs. For example:
# itertools.permutations(range(3), 2) results in:

View File

@ -37,7 +37,7 @@ LOG = logging.getLogger(__name__)
class BaseConnectivitySameNetworkTest(base.BaseFullStackTestCase):
arp_responder = False
use_dhcp = True
use_dhcp = False
num_hosts = 3
@ -166,23 +166,6 @@ class TestLinuxBridgeConnectivitySameNetwork(BaseConnectivitySameNetworkTest):
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(
BaseConnectivitySameNetworkTest):

View File

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

View File

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

View File

@ -52,7 +52,7 @@ class BaseSecurityGroupsSameNetworkTest(base.BaseFullStackTestCase):
environment.HostDescription(
l2_agent_type=self.l2_agent_type,
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(
environment.EnvironmentDescription(
network_type=self.network_type,
@ -246,11 +246,10 @@ class TestSecurityGroupsSameNetwork(BaseSecurityGroupsSameNetworkTest):
tenant_uuid,
self.safe_client,
neutron_port=ports[-1],
use_dhcp=True)))
use_dhcp=False)))
self.assertEqual(5, len(vms))
vms[4].block_until_boot()
vms[4].block_until_dhcp_config_done()
netcat = net_helpers.NetcatTester(vms[4].namespace,
vms[0].namespace, vms[0].ip, 3355,
@ -566,10 +565,9 @@ class TestSecurityGroupsSameNetwork(BaseSecurityGroupsSameNetworkTest):
tenant_uuid,
self.safe_client,
neutron_port=ports[port],
use_dhcp=True))
use_dhcp=False))
for port, host in enumerate(index_to_host)]
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