]> git.ipfire.org Git - thirdparty/systemd.git/commit
networkd: print a meaningful error on failure
authorMatteo Croce <teknoraver@meta.com>
Thu, 22 May 2025 03:41:49 +0000 (05:41 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 22 May 2025 07:33:39 +0000 (09:33 +0200)
commit6288739eaf70f32409626c85c4fde172e8f47e09
tree30d71e2c1dae674160904586a9a3fd5f14a93ac1
parent9daa1dbcce865c3ab223804e1b7b64ce656a0eb0
networkd: print a meaningful error on failure

test_keep_configuration_on_restart() works, but the error printed is
misleading because self.assertNotEmpty() doesn't exist.

Add a working assert statement so, when the unmanaged interface is
altered, the test fails with a meaningful error, like:

        ### ip monitor dev unmanaged0 BEGIN
        222:33::/64 proto kernel metric 256 pref medium
        FAIL
        [...]
        Traceback (most recent call last):
          File "/work/src/test/test-network/systemd-networkd-tests.py", line 5085, in test_keep_configuration_on_restart
            self.assertEqual(line, '')
        AssertionError: '222:33::/64 proto kernel metric 256 pref medium' != ''
        - 222:33::/64 proto kernel metric 256 pref medium

While at it, strip the trailing newline so we can print easily the
string (and in future build more a robust regexp which uses the $ token)
test/test-network/systemd-networkd-tests.py