summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2019-04-02 06:10:36 +0900
committerGitHub <noreply@github.com>2019-04-02 06:10:36 +0900
commitdd09a9ec0f3f32ebedb52ddb8ae983e7de812d14 (patch)
tree8b08173e7b2e6329d7f8ba1a0fa6cd8c71f7e908 /test
parent7a24df5eccdd04aad45d5e8195662e87d7dd4af1 (diff)
parent03db80b2d1edde5451fc396c846339b5e4fd8ef7 (diff)
downloadsystemd-dd09a9ec0f3f32ebedb52ddb8ae983e7de812d14.tar.gz
Merge pull request #12160 from yuwata/wait-online-allow-configuring
wait-online: add --any option
Diffstat (limited to 'test')
-rw-r--r--test/test-network/conf/11-dummy.network5
-rw-r--r--test/test-network/conf/25-bridge.network5
-rwxr-xr-xtest/test-network/systemd-networkd-tests.py25
3 files changed, 32 insertions, 3 deletions
diff --git a/test/test-network/conf/11-dummy.network b/test/test-network/conf/11-dummy.network
new file mode 100644
index 0000000000..b117028a84
--- /dev/null
+++ b/test/test-network/conf/11-dummy.network
@@ -0,0 +1,5 @@
+[Match]
+Name=test1
+
+[Network]
+IPv6AcceptRA=no
diff --git a/test/test-network/conf/25-bridge.network b/test/test-network/conf/25-bridge.network
new file mode 100644
index 0000000000..d2f346388d
--- /dev/null
+++ b/test/test-network/conf/25-bridge.network
@@ -0,0 +1,5 @@
+[Match]
+Name=bridge99
+
+[Network]
+IPv6AcceptRA=no
diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py
index a246379644..ffc63d0838 100755
--- a/test/test-network/systemd-networkd-tests.py
+++ b/test/test-network/systemd-networkd-tests.py
@@ -71,7 +71,6 @@ def expectedFailureIfRoutingPolicyIPProtoIsNotAvailable():
return f
def setUpModule():
-
os.makedirs(network_unit_file_path, exist_ok=True)
os.makedirs(networkd_ci_path, exist_ok=True)
@@ -186,8 +185,10 @@ class Utilities():
if sleep_sec > 0:
time.sleep(sleep_sec)
- def wait_online(self, links_with_operstate, timeout='20s'):
- args = [wait_online_bin, f' --timeout={timeout}'] + [f'--interface={link}' for link in links_with_operstate]
+ def wait_online(self, links_with_operstate, timeout='20s', bool_any=False):
+ args = [wait_online_bin, f'--timeout={timeout}'] + [f'--interface={link}' for link in links_with_operstate]
+ if bool_any:
+ args += ['--any']
subprocess.check_call(args)
class NetworkdNetDevTests(unittest.TestCase, Utilities):
@@ -248,6 +249,7 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
units = [
'10-dropin-test.netdev',
'11-dummy.netdev',
+ '11-dummy.network',
'12-dummy.netdev',
'15-name-conflict-test.netdev',
'21-macvlan.netdev',
@@ -259,6 +261,7 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
'25-bond.netdev',
'25-bond-balanced-tlb.netdev',
'25-bridge.netdev',
+ '25-bridge.network',
'25-erspan-tunnel-local-any.netdev',
'25-erspan-tunnel.netdev',
'25-fou-gretap.netdev',
@@ -367,6 +370,22 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
else:
print('ethtool does not support driver field at least for dummy interfaces, skipping test for Driver field of networkctl.')
+ def test_wait_online_any(self):
+ self.copy_unit_to_networkd_unit_path('25-bridge.netdev', '25-bridge.network', '11-dummy.netdev', '11-dummy.network')
+ self.start_networkd(0)
+
+ self.wait_online(['bridge99', 'test1:degraded'], bool_any=True)
+ self.assertTrue(self.link_exits('bridge99'))
+ self.assertTrue(self.link_exits('test1'))
+
+ output = subprocess.check_output(['networkctl', 'status', 'bridge99']).rstrip().decode('utf-8')
+ print(output)
+ self.assertRegex(output, 'State: (?:off|no-carrier) \(configuring\)')
+
+ output = subprocess.check_output(['networkctl', 'status', 'test1']).rstrip().decode('utf-8')
+ print(output)
+ self.assertRegex(output, 'State: degraded \(configured\)')
+
def test_bridge(self):
self.copy_unit_to_networkd_unit_path('25-bridge.netdev')
self.start_networkd()