[Fullstack] Remove dhcp agent in tests where it isn't necessary
In fullstack tests like test_connectivity or test_securitygroup using dhcp agent isn't really needed. We are testing dhcp agents and configuration of the IP addresses using DHCP in the tests from the test_dhcp_agent module. So this patch disables usage of the dhcp agent where it's not really needed to save some resources (less agents running during tests) and to minimize potential failures in the tests. Additionally this patch also adds method block_until_all_dhcp_config_done() to the FakeFullstackMachinesList class and uses it in tests when fake VMs are using DHCP. That will hopefully help better understand where the issue is in case of failures like described in the related bug. Related-Bug: #1962854 Change-Id: Ib6ca18b5a0ae101ad6424637abff3d992737f6f4
This commit is contained in:
parent
1b68aebaba
commit
282ccbb8f0
@ -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):
|
||||
|
@ -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:
|
||||
|
@ -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):
|
||||
|
||||
|
@ -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',
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user