diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/meson.build | 12 | ||||
-rwxr-xr-x | test/test-network/systemd-networkd-tests.py | 19 | ||||
-rw-r--r-- | test/test.service.in | 4 |
3 files changed, 21 insertions, 14 deletions
diff --git a/test/meson.build b/test/meson.build index 9d1a069fc9..ceebb72bae 100644 --- a/test/meson.build +++ b/test/meson.build @@ -142,11 +142,13 @@ endif ############################################################ if install_tests - foreach script : ['integration-test-setup.sh', 'run-unit-tests.py'] - install_data(script, - install_mode : 'rwxr-xr-x', - install_dir : testsdir) - endforeach + install_data('run-unit-tests.py', + install_mode : 'rwxr-xr-x', + install_dir : testsdir) + + install_data('integration-test-setup.sh', + install_mode : 'rwxr-xr-x', + install_dir : testdata_dir) endif ############################################################ diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py index 8ee94a0294..111da949ab 100755 --- a/test/test-network/systemd-networkd-tests.py +++ b/test/test-network/systemd-networkd-tests.py @@ -6705,7 +6705,6 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities): '--dhcp-option=option6:ntp-server,[2600::ff]') networkctl_reload() - networkctl_reconfigure('veth99') # Release previously acquired lease and start new DHCPv6 handshake. self.wait_online('veth99:routable', 'veth-peer:routable') # checking address @@ -7448,7 +7447,7 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities): self.assertIn('inet 169.254.133.11/16 metric 2048 brd 169.254.255.255 scope link', output) def test_dhcp_client_use_dns(self): - def check(self, ipv4, ipv6): + def check(self, ipv4, ipv6, needs_reconfigure=False): os.makedirs(os.path.join(network_unit_dir, '25-dhcp-client.network.d'), exist_ok=True) with open(os.path.join(network_unit_dir, '25-dhcp-client.network.d/override.conf'), mode='w', encoding='utf-8') as f: f.write('[DHCPv4]\nUseDNS=') @@ -7458,6 +7457,8 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities): f.write('\n[IPv6AcceptRA]\nUseDNS=no') networkctl_reload() + if needs_reconfigure: + networkctl_reconfigure('veth99') self.wait_online('veth99:routable') # link becomes 'routable' when at least one protocol provide an valid address. Hence, we need to explicitly wait for both addresses. @@ -7489,7 +7490,7 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities): check(self, True, True) check(self, True, False) - check(self, False, True) + check(self, False, True, needs_reconfigure=True) check(self, False, False) def test_dhcp_client_default_use_domains(self): @@ -7541,7 +7542,7 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities): check(self, False, False, False) def test_dhcp_client_use_dnr(self): - def check(self, ipv4, ipv6): + def check(self, ipv4, ipv6, needs_reconfigure=False): os.makedirs(os.path.join(network_unit_dir, '25-dhcp-client.network.d'), exist_ok=True) with open(os.path.join(network_unit_dir, '25-dhcp-client.network.d/override.conf'), mode='w', encoding='utf-8') as f: f.write('[DHCPv4]\nUseDNS=') @@ -7551,6 +7552,8 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities): f.write('\n[IPv6AcceptRA]\nUseDNS=no') networkctl_reload() + if needs_reconfigure: + networkctl_reconfigure('veth99') self.wait_online('veth99:routable') # link becomes 'routable' when at least one protocol provide an valid address. Hence, we need to explicitly wait for both addresses. @@ -7587,11 +7590,11 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities): check(self, True, True) check(self, True, False) - check(self, False, True) + check(self, False, True, needs_reconfigure=True) check(self, False, False) def test_dhcp_client_use_captive_portal(self): - def check(self, ipv4, ipv6): + def check(self, ipv4, ipv6, needs_reconfigure=False): os.makedirs(os.path.join(network_unit_dir, '25-dhcp-client.network.d'), exist_ok=True) with open(os.path.join(network_unit_dir, '25-dhcp-client.network.d/override.conf'), mode='w', encoding='utf-8') as f: f.write('[DHCPv4]\nUseCaptivePortal=') @@ -7601,6 +7604,8 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities): f.write('\n[IPv6AcceptRA]\nUseCaptivePortal=no') networkctl_reload() + if needs_reconfigure: + networkctl_reconfigure('veth99') self.wait_online('veth99:routable') # link becomes 'routable' when at least one protocol provide an valid address. Hence, we need to explicitly wait for both addresses. @@ -7625,7 +7630,7 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities): check(self, True, True) check(self, True, False) - check(self, False, True) + check(self, False, True, needs_reconfigure=True) check(self, False, False) def test_dhcp_client_reject_captive_portal(self): diff --git a/test/test.service.in b/test/test.service.in index 48c09baf6c..6400be0700 100644 --- a/test/test.service.in +++ b/test/test.service.in @@ -7,9 +7,9 @@ Before=getty-pre.target [Service] ExecStartPre=rm -f /failed /testok -ExecStartPre=/usr/lib/systemd/tests/integration-test-setup.sh setup +ExecStartPre=/usr/lib/systemd/tests/testdata/integration-test-setup.sh setup ExecStart=@command@ -ExecStopPost=/usr/lib/systemd/tests/integration-test-setup.sh finalize +ExecStopPost=/usr/lib/systemd/tests/testdata/integration-test-setup.sh finalize Type=oneshot MemoryAccounting=@memory-accounting@ StateDirectory=%N |