Skip to content

Commit

Permalink
tests:base: avoid long waits
Browse files Browse the repository at this point in the history
  • Loading branch information
slyon committed Mar 16, 2021
1 parent b98a160 commit 6270143
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 35 deletions.
1 change: 1 addition & 0 deletions tests/integration/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ def setup_eth(self, ipv6_mode, start_dnsmasq=True):
subprocess.check_call(['ip', 'link', 'set', self.dev_e2_ap, 'up'])
if start_dnsmasq:
self.start_dnsmasq(ipv6_mode, self.dev_e_ap)
self.start_dnsmasq(ipv6_mode, self.dev_e2_ap)

#
# Internal implementation details
Expand Down
9 changes: 1 addition & 8 deletions tests/integration/bonds.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ def test_bond_mac(self):
match:
name: %(ec)s
macaddress: %(ec_mac)s
%(e2c)s: {}
bonds:
mybond:
interfaces: [ethbn]
Expand Down Expand Up @@ -428,7 +429,6 @@ def test_bond_up_delay(self):

def test_bond_arp_interval(self):
self.setup_eth(None)
self.start_dnsmasq(None, self.dev_e2_ap)
self.addCleanup(subprocess.call, ['ip', 'link', 'delete', 'mybond'], stderr=subprocess.DEVNULL)
with open(self.config, 'w') as f:
f.write('''network:
Expand Down Expand Up @@ -458,7 +458,6 @@ def test_bond_arp_interval(self):

def test_bond_arp_targets(self):
self.setup_eth(None)
self.start_dnsmasq(None, self.dev_e2_ap)
self.addCleanup(subprocess.call, ['ip', 'link', 'delete', 'mybond'], stderr=subprocess.DEVNULL)
with open(self.config, 'w') as f:
f.write('''network:
Expand Down Expand Up @@ -488,7 +487,6 @@ def test_bond_arp_targets(self):

def test_bond_arp_targets_many_lp1829264(self):
self.setup_eth(None)
self.start_dnsmasq(None, self.dev_e2_ap)
self.addCleanup(subprocess.call, ['ip', 'link', 'delete', 'mybond'], stderr=subprocess.DEVNULL)
with open(self.config, 'w') as f:
f.write('''network:
Expand Down Expand Up @@ -520,7 +518,6 @@ def test_bond_arp_targets_many_lp1829264(self):

def test_bond_arp_all_targets(self):
self.setup_eth(None)
self.start_dnsmasq(None, self.dev_e2_ap)
self.addCleanup(subprocess.call, ['ip', 'link', 'delete', 'mybond'], stderr=subprocess.DEVNULL)
with open(self.config, 'w') as f:
f.write('''network:
Expand Down Expand Up @@ -552,7 +549,6 @@ def test_bond_arp_all_targets(self):

def test_bond_arp_validate(self):
self.setup_eth(None)
self.start_dnsmasq(None, self.dev_e2_ap)
self.addCleanup(subprocess.call, ['ip', 'link', 'delete', 'mybond'], stderr=subprocess.DEVNULL)
with open(self.config, 'w') as f:
f.write('''network:
Expand Down Expand Up @@ -651,7 +647,6 @@ def test_bond_up_delay(self):

def test_bond_arp_interval(self):
self.setup_eth(None)
self.start_dnsmasq(None, self.dev_e2_ap)
self.addCleanup(subprocess.call, ['ip', 'link', 'delete', 'mybond'], stderr=subprocess.DEVNULL)
with open(self.config, 'w') as f:
f.write('''network:
Expand Down Expand Up @@ -681,7 +676,6 @@ def test_bond_arp_interval(self):

def test_bond_arp_targets(self):
self.setup_eth(None)
self.start_dnsmasq(None, self.dev_e2_ap)
self.addCleanup(subprocess.call, ['ip', 'link', 'delete', 'mybond'], stderr=subprocess.DEVNULL)
with open(self.config, 'w') as f:
f.write('''network:
Expand Down Expand Up @@ -711,7 +705,6 @@ def test_bond_arp_targets(self):

def test_bond_arp_all_targets(self):
self.setup_eth(None)
self.start_dnsmasq(None, self.dev_e2_ap)
self.addCleanup(subprocess.call, ['ip', 'link', 'delete', 'mybond'], stderr=subprocess.DEVNULL)
with open(self.config, 'w') as f:
f.write('''network:
Expand Down
14 changes: 1 addition & 13 deletions tests/integration/bridges.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class _CommonTests():

def test_eth_and_bridge(self):
self.setup_eth(None)
self.start_dnsmasq(None, self.dev_e2_ap)
self.addCleanup(subprocess.call, ['ip', 'link', 'delete', 'mybr'], stderr=subprocess.DEVNULL)
with open(self.config, 'w') as f:
f.write('''network:
Expand Down Expand Up @@ -69,7 +68,6 @@ def test_eth_and_bridge(self):
def test_bridge_path_cost(self):
self.setup_eth(None)
self.addCleanup(subprocess.call, ['ip', 'link', 'delete', 'mybr'], stderr=subprocess.DEVNULL)
self.start_dnsmasq(None, self.dev_e2_ap)
with open(self.config, 'w') as f:
f.write('''network:
renderer: %(r)s
Expand Down Expand Up @@ -103,7 +101,6 @@ def test_bridge_path_cost(self):
def test_bridge_ageing_time(self):
self.setup_eth(None)
self.addCleanup(subprocess.call, ['ip', 'link', 'delete', 'mybr'], stderr=subprocess.DEVNULL)
self.start_dnsmasq(None, self.dev_e2_ap)
with open(self.config, 'w') as f:
f.write('''network:
renderer: %(r)s
Expand Down Expand Up @@ -136,7 +133,6 @@ def test_bridge_ageing_time(self):
def test_bridge_max_age(self):
self.setup_eth(None)
self.addCleanup(subprocess.call, ['ip', 'link', 'delete', 'mybr'], stderr=subprocess.DEVNULL)
self.start_dnsmasq(None, self.dev_e2_ap)
with open(self.config, 'w') as f:
f.write('''network:
renderer: %(r)s
Expand Down Expand Up @@ -169,7 +165,6 @@ def test_bridge_max_age(self):
def test_bridge_hello_time(self):
self.setup_eth(None)
self.addCleanup(subprocess.call, ['ip', 'link', 'delete', 'mybr'], stderr=subprocess.DEVNULL)
self.start_dnsmasq(None, self.dev_e2_ap)
with open(self.config, 'w') as f:
f.write('''network:
renderer: %(r)s
Expand Down Expand Up @@ -202,7 +197,6 @@ def test_bridge_hello_time(self):
def test_bridge_forward_delay(self):
self.setup_eth(None)
self.addCleanup(subprocess.call, ['ip', 'link', 'delete', 'mybr'], stderr=subprocess.DEVNULL)
self.start_dnsmasq(None, self.dev_e2_ap)
with open(self.config, 'w') as f:
f.write('''network:
renderer: %(r)s
Expand Down Expand Up @@ -235,7 +229,6 @@ def test_bridge_forward_delay(self):
def test_bridge_stp_false(self):
self.setup_eth(None)
self.addCleanup(subprocess.call, ['ip', 'link', 'delete', 'mybr'], stderr=subprocess.DEVNULL)
self.start_dnsmasq(None, self.dev_e2_ap)
with open(self.config, 'w') as f:
f.write('''network:
renderer: %(r)s
Expand Down Expand Up @@ -275,7 +268,6 @@ class TestNetworkd(IntegrationTestsBase, _CommonTests):
def test_bridge_mac(self):
self.setup_eth(None)
self.addCleanup(subprocess.call, ['ip', 'link', 'delete', 'br0'], stderr=subprocess.DEVNULL)
self.start_dnsmasq(None, self.dev_e2_ap)
with open(self.config, 'w') as f:
f.write('''network:
renderer: %(r)s
Expand All @@ -284,6 +276,7 @@ def test_bridge_mac(self):
match:
name: %(ec)s
macaddress: %(ec_mac)s
%(e2c)s: {}
bridges:
br0:
interfaces: [ethbr]
Expand All @@ -301,7 +294,6 @@ def test_bridge_mac(self):
def test_bridge_anonymous(self):
self.setup_eth(None)
self.addCleanup(subprocess.call, ['ip', 'link', 'delete', 'mybr'], stderr=subprocess.DEVNULL)
self.start_dnsmasq(None, self.dev_e2_ap)
with open(self.config, 'w') as f:
f.write('''network:
renderer: %(r)s
Expand Down Expand Up @@ -329,7 +321,6 @@ def test_bridge_anonymous(self):
def test_bridge_isolated(self):
self.setup_eth(None)
self.addCleanup(subprocess.call, ['ip', 'link', 'delete', 'mybr'], stderr=subprocess.DEVNULL)
self.start_dnsmasq(None, self.dev_e2_ap)
with open(self.config, 'w') as f:
f.write('''network:
renderer: %(r)s
Expand All @@ -349,7 +340,6 @@ def test_bridge_isolated(self):
def test_bridge_port_priority(self):
self.setup_eth(None)
self.addCleanup(subprocess.call, ['ip', 'link', 'delete', 'mybr'], stderr=subprocess.DEVNULL)
self.start_dnsmasq(None, self.dev_e2_ap)
with open(self.config, 'w') as f:
f.write('''network:
renderer: %(r)s
Expand Down Expand Up @@ -393,7 +383,6 @@ def test_bridge_mac(self):
def test_bridge_priority(self):
self.setup_eth(None)
self.addCleanup(subprocess.call, ['ip', 'link', 'delete', 'mybr'], stderr=subprocess.DEVNULL)
self.start_dnsmasq(None, self.dev_e2_ap)
with open(self.config, 'w') as f:
f.write('''network:
renderer: %(r)s
Expand Down Expand Up @@ -426,7 +415,6 @@ def test_bridge_priority(self):
def test_bridge_port_priority(self):
self.setup_eth(None)
self.addCleanup(subprocess.call, ['ip', 'link', 'delete', 'mybr'], stderr=subprocess.DEVNULL)
self.start_dnsmasq(None, self.dev_e2_ap)
with open(self.config, 'w') as f:
f.write('''network:
renderer: %(r)s
Expand Down
4 changes: 0 additions & 4 deletions tests/integration/ethernets.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class _CommonTests():

def test_eth_mtu(self):
self.setup_eth(None)
self.start_dnsmasq(None, self.dev_e2_ap)
with open(self.config, 'w') as f:
f.write('''network:
renderer: %(r)s
Expand All @@ -55,7 +54,6 @@ def test_eth_mtu(self):

def test_eth_mac(self):
self.setup_eth(None)
self.start_dnsmasq(None, self.dev_e2_ap)
with open(self.config, 'w') as f:
f.write('''network:
renderer: %(r)s
Expand All @@ -81,7 +79,6 @@ def test_eth_glob(self):
Interface globbing was introduced as of NM 1.14+'''
self.setup_eth(None)
self.start_dnsmasq(None, self.dev_e2_ap)
with open(self.config, 'w') as f:
f.write('''network:
renderer: %(r)s
Expand Down Expand Up @@ -175,7 +172,6 @@ def test_manual_addresses(self):
addresses: ["172.16.7.2/30", "4321:AAAA::99/80"]
dhcp4: yes
''' % {'r': self.backend, 'ec': self.dev_e_client, 'e2c': self.dev_e2_client})
self.start_dnsmasq(None, self.dev_e2_ap)
self.generate_and_settle()
if self.backend == 'NetworkManager':
self.nm_online_full(self.dev_e2_client)
Expand Down
12 changes: 8 additions & 4 deletions tests/integration/ovs.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,13 @@ def test_cleanup_interfaces(self):
# If we have just OVS interfaces/ports networkd/networkctl will not be
# aware that our network is ready.
%(ec)s: {addresses: [10.10.10.20/24]}
%(e2c)s: {addresses: [10.10.10.30/24]}
openvswitch:
ports:
- [patch0-1, patch1-0]
bridges:
ovs0: {interfaces: [patch0-1]}
ovs1: {interfaces: [patch1-0]}''' % {'ec': self.dev_e_client})
ovs1: {interfaces: [patch1-0]}''' % {'ec': self.dev_e_client, 'e2c': self.dev_e2_client})
self.generate_and_settle()
# Basic verification that the bridges/ports/interfaces are there in OVS
out = subprocess.check_output(['ovs-vsctl', 'show'])
Expand Down Expand Up @@ -119,12 +120,13 @@ def test_cleanup_patch_ports(self):
f.write('''network:
ethernets:
%(ec)s: {addresses: [10.10.10.20/24]}
%(e2c)s: {addresses: [10.10.10.30/24]}
openvswitch:
ports: [[patch0-1, patch1-0]]
bonds:
bond0: {interfaces: [patch1-0, %(ec)s]}
bridges:
ovs0: {interfaces: [patch0-1, bond0]}''' % {'ec': self.dev_e_client})
ovs0: {interfaces: [patch0-1, bond0]}''' % {'ec': self.dev_e_client, 'e2c': self.dev_e2_client})
self.generate_and_settle()
# Basic verification that the bridges/ports/interfaces are there in OVS
out = subprocess.check_output(['ovs-vsctl', 'show'])
Expand All @@ -137,6 +139,7 @@ def test_cleanup_patch_ports(self):
f.write('''network:
ethernets:
%(ec)s: {addresses: [10.10.10.20/24]}
%(ec)s: {addresses: [10.10.10.30/24]}
openvswitch:
ports: [[patchx, patchy]]
bonds:
Expand Down Expand Up @@ -283,7 +286,7 @@ def test_bond_base(self):
self.assert_iface('ovsbr', ['inet 192.170.1.1/24'])

def test_bridge_patch_ports(self):
self.setup_eth(None, False)
self.setup_eth(None)
self.addCleanup(subprocess.call, ['ovs-vsctl', '--if-exists', 'del-br', 'br0'])
self.addCleanup(subprocess.call, ['ovs-vsctl', '--if-exists', 'del-br', 'br1'])
self.addCleanup(subprocess.call, ['ovs-vsctl', '--if-exists', 'del-port', 'patch0-1'])
Expand Down Expand Up @@ -374,11 +377,12 @@ def test_vlan_maas(self):
nameservers:
addresses: [10.5.32.99]
search: [maas]
%(e2c)s: {}
vlans:
%(ec)s.21:
id: 21
link: %(ec)s
mtu: 1500''' % {'ec': self.dev_e_client})
mtu: 1500''' % {'ec': self.dev_e_client, 'e2c': self.dev_e2_client})
self.generate_and_settle()
# Basic verification that the interfaces/ports are set up in OVS
out = subprocess.check_output(['ovs-vsctl', 'show'], universal_newlines=True)
Expand Down
1 change: 0 additions & 1 deletion tests/integration/regressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class TestNetworkd(IntegrationTestsBase, _CommonTests):

def test_lp1802322_bond_mac_rename(self):
self.setup_eth(None)
self.start_dnsmasq(None, self.dev_e2_ap)
self.addCleanup(subprocess.call, ['ip', 'link', 'delete', 'mybond'], stderr=subprocess.DEVNULL)
with open(self.config, 'w') as f:
f.write('''network:
Expand Down
5 changes: 0 additions & 5 deletions tests/integration/routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def test_route_on_link(self):
The on-link option was introduced as of NM 1.12+ (for IPv4)
The on-link option was introduced as of NM 1.18+ (for IPv6)'''
self.setup_eth(None)
self.start_dnsmasq(None, self.dev_e2_ap)
with open(self.config, 'w') as f:
f.write('''network:
renderer: %(r)s
Expand All @@ -59,7 +58,6 @@ def test_route_from(self):
The from option was introduced as of NM 1.8+'''
self.setup_eth(None)
self.start_dnsmasq(None, self.dev_e2_ap)
with open(self.config, 'w') as f:
f.write('''network:
renderer: %(r)s
Expand All @@ -82,7 +80,6 @@ def test_route_table(self):
The table option was introduced as of NM 1.10+'''
self.setup_eth(None)
self.start_dnsmasq(None, self.dev_e2_ap)
table_id = '255' # This is the 'local' FIB of /etc/iproute2/rt_tables
with open(self.config, 'w') as f:
f.write('''network:
Expand Down Expand Up @@ -263,7 +260,6 @@ def test_link_route_v4(self):
@unittest.skip("networkd does not handle non-unicast routes correctly yet (Invalid argument)")
def test_route_type_blackhole(self):
self.setup_eth(None)
self.start_dnsmasq(None, self.dev_e2_ap)
with open(self.config, 'w') as f:
f.write('''network:
renderer: %(r)s
Expand All @@ -283,7 +279,6 @@ def test_route_type_blackhole(self):

def test_route_with_policy(self):
self.setup_eth(None)
self.start_dnsmasq(None, self.dev_e2_ap)
with open(self.config, 'w') as f:
f.write('''network:
renderer: %(r)s
Expand Down

0 comments on commit 6270143

Please sign in to comment.