]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-network: call networkctl only when specified interface exists 23576/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 31 May 2022 19:01:10 +0000 (04:01 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 31 May 2022 19:02:49 +0000 (04:02 +0900)
Otherwise, this easily trigger another exception:
```
======================================================================
ERROR: test_erspan_tunnel_v0 (__main__.NetworkdNetDevTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./test/test-network/systemd-networkd-tests.py", line 686, in wait_online
    check_output(*args, env=env)
  File "./test/test-network/systemd-networkd-tests.py", line 65, in check_output
    return subprocess.check_output(command, universal_newlines=True, **kwargs).rstrip()
  File "/usr/lib64/python3.6/subprocess.py", line 356, in check_output
    **kwargs).stdout
  File "/usr/lib64/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/usr/lib/systemd/systemd-networkd-wait-online', '--timeout=20s', '--interface=erspan99:routable', '--interface=erspan98:routable', '--interface=dummy98:degraded']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./test/test-network/systemd-networkd-tests.py", line 1808, in test_erspan_tunnel_v0
    self.wait_online(['erspan99:routable', 'erspan98:routable', 'dummy98:degraded'])
  File "./test/test-network/systemd-networkd-tests.py", line 689, in wait_online
    output = check_output(*networkctl_cmd, '-n', '0', 'status', link.split(':')[0], env=env)
  File "./test/test-network/systemd-networkd-tests.py", line 65, in check_output
    return subprocess.check_output(command, universal_newlines=True, **kwargs).rstrip()
  File "/usr/lib64/python3.6/subprocess.py", line 356, in check_output
    **kwargs).stdout
  File "/usr/lib64/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/usr/bin/networkctl', '-n', '0', 'status', 'erspan99']' returned non-zero exit status 1.
```

test/test-network/systemd-networkd-tests.py

index 7be99f2509c7e0108b9fe64b3d2f558dfec7dc2b..7a962ba7084ab33e7c21ccaaedd577a21e6b7840 100755 (executable)
@@ -699,8 +699,10 @@ class Utilities():
             check_output(*args, env=env)
         except subprocess.CalledProcessError:
             for link in links_with_operstate:
-                output = check_output(*networkctl_cmd, '-n', '0', 'status', link.split(':')[0], env=env)
-                print(output)
+                name = link.split(':')[0]
+                if link_exists(name):
+                    output = check_output(*networkctl_cmd, '-n', '0', 'status', name, env=env)
+                    print(output)
             raise
         if not bool_any and setup_state:
             for link in links_with_operstate: