]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-network: verify json format about DHCPv6 client status 29937/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 8 Nov 2023 16:31:17 +0000 (01:31 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 8 Nov 2023 16:31:17 +0000 (01:31 +0900)
test/test-network/systemd-networkd-tests.py

index fd2906ef6b92b8f29b0c5a11471b53def73b65b3..c77a0e0eb2db2d6afe19feb4d731e6d310711b0a 100755 (executable)
@@ -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()