]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-network: wait for the state file being updated 29687/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 24 Oct 2023 09:38:30 +0000 (18:38 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 24 Oct 2023 14:22:27 +0000 (23:22 +0900)
Also, sync state files before read.

Addresses the first issue in #29678.

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

index 122f9e875dd279a99dd2e00e0f0d2c6900386667..58c289748db71ad4a96808f7e06cbbb6cfc6d954 100755 (executable)
@@ -5122,6 +5122,15 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
                       ra_mode='ra-stateless')
         self.wait_online(['veth99:routable', 'veth-peer:routable'])
 
+        # DHCPv6 REPLY for INFORMATION-REQUEST may be received after the link entered configured state.
+        # Let's wait for the expected DNS server being listed in the state file.
+        for _ in range(100):
+            output = read_link_state_file('veth99')
+            print(output)
+            if 'DNS=2600::ee' in output:
+                break
+            time.sleep(.2)
+
         # Check link state file
         print('## link state file')
         output = read_link_state_file('veth99')
@@ -5169,6 +5178,9 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
         print(output)
         self.assertRegex(output, 'token :: dev veth99')
 
+        # Make manager and link state file updated
+        check_output(*resolvectl_cmd, 'revert', 'veth99', env=env)
+
         # Check link state file
         print('## link state file')
         output = read_link_state_file('veth99')
@@ -5215,6 +5227,9 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
         print(output)
         self.assertRegex(output, 'via fe80::1034:56ff:fe78:9abd')
 
+        # Make manager and link state file updated
+        check_output(*resolvectl_cmd, 'revert', 'veth99', env=env)
+
         # Check link state file
         print('## link state file')
         output = read_link_state_file('veth99')