summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2023-11-08 17:31:17 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2023-11-08 17:31:17 +0100
commit3aa47694d1b2d8f142ee1daf83f7ddcb9044c716 (patch)
treea9b6f1d81f7394deb16da1636a18ebced3451f6d
parentnetwork: fix json generation (diff)
downloadsystemd-3aa47694d1b2d8f142ee1daf83f7ddcb9044c716.tar.xz
systemd-3aa47694d1b2d8f142ee1daf83f7ddcb9044c716.zip
test-network: verify json format about DHCPv6 client status
-rwxr-xr-xtest/test-network/systemd-networkd-tests.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py
index fd2906ef6b..c77a0e0eb2 100755
--- a/test/test-network/systemd-networkd-tests.py
+++ b/test/test-network/systemd-networkd-tests.py
@@ -5177,6 +5177,10 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
self.assertNotIn('DHCPREQUEST(veth-peer)', output)
self.assertNotIn('DHCPREPLY(veth-peer)', output)
+ # Check json format
+ output = check_output(*networkctl_cmd, '--json=short', 'status', 'veth99', env=env)
+ check_json(output)
+
# solicit mode
stop_dnsmasq()
start_dnsmasq('--dhcp-option=108,00:00:02:00',
@@ -5228,6 +5232,11 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
self.assertIn('DHCPREPLY(veth-peer)', output)
self.assertIn('sent size: 0 option: 14 rapid-commit', output)
+ # Check json format
+ output = check_output(*networkctl_cmd, '--json=short', 'status', 'veth99', env=env)
+ check_json(output)
+
+ # Testing without rapid commit support
with open(os.path.join(network_unit_dir, '25-dhcp-client-ipv6-only.network'), mode='a', encoding='utf-8') as f:
f.write('\n[DHCPv6]\nRapidCommit=no\n')
@@ -5277,6 +5286,10 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
self.assertIn('DHCPREPLY(veth-peer)', output)
self.assertNotIn('rapid-commit', output)
+ # Check json format
+ output = check_output(*networkctl_cmd, '--json=short', 'status', 'veth99', env=env)
+ check_json(output)
+
def test_dhcp_client_ipv6_dbus_status(self):
copy_network_unit('25-veth.netdev', '25-dhcp-server-veth-peer.network', '25-dhcp-client-ipv6-only.network')
start_networkd()