]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-network: wait for a while if manual policy is always-{up,down} 22277/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 27 Jan 2022 22:29:32 +0000 (07:29 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 27 Jan 2022 22:29:37 +0000 (07:29 +0900)
If wait_operstate() is called super quickly after ip command, then the
up/down state may not be changed and propagated to networkd, and
wait_operstate() mistakenly pass with the previous state.

To avoid such situation, wait for a while to make networkd actually
detect the interface brought up/down.

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

index c53092562a5eb42dfa9d99ef6ae3de9144329e90..ba1617039357492482661fe9595ae6c537f826cb 100755 (executable)
@@ -3101,6 +3101,8 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
                 check_output('ip link set dev test1 down')
             expect_up = initial_up if always else next_up
             next_up = not next_up
+            if always:
+                time.sleep(1)
 
     def test_activation_policy(self):
         for test in ['up', 'always-up', 'manual', 'always-down', 'down', '']: