From db4bf873cb81e05e75648db9db0357ef5563e2e7 Mon Sep 17 00:00:00 2001 From: Wen Liang Date: Wed, 9 Mar 2022 15:39:03 -0500 Subject: [PATCH] Clean up connection profile after running pytest Running the pytest with nm provider failed in the downstream testing because the "NM_CONTROLLED=no" appeared in `/etc/sysconfig/network-scripts/ifcfg-testeth` which caused the veth `testeth` strictly unmanaged by NetworkManager. To fix it, clean up such a connection profile at the end when running the pytest. Signed-off-by: Wen Liang --- tests/integration/test_ethernet.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/integration/test_ethernet.py b/tests/integration/test_ethernet.py index 4fc7417..f9cdc1c 100644 --- a/tests/integration/test_ethernet.py +++ b/tests/integration/test_ethernet.py @@ -78,6 +78,15 @@ def testnic1(): yield veth_name finally: subprocess.call(["ip", "link", "delete", veth_name]) + if os.path.isfile("/etc/sysconfig/network-scripts/ifcfg-" + veth_name): + os.unlink("/etc/sysconfig/network-scripts/ifcfg-" + veth_name) + subprocess.call( + [ + "nmcli", + "con", + "reload", + ] + ) def _get_ip_addresses(interface):