From 5d404b4fc31c423c86f71b8ec01516c5159689f5 Mon Sep 17 00:00:00 2001 From: Hanne Moa Date: Tue, 21 Nov 2023 14:44:11 +0100 Subject: [PATCH] Use gosu onstead of sudo for pping tests --- tests/integration/pping_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration/pping_test.py b/tests/integration/pping_test.py index bc71d603ea..f4ce024ef5 100644 --- a/tests/integration/pping_test.py +++ b/tests/integration/pping_test.py @@ -76,12 +76,12 @@ def test_pping_should_post_event_when_host_is_unreachable( def get_root_method(): if os.geteuid() == 0: return [] + elif os.system("gosu root true") == 0: + return ["gosu", "root"] elif os.system("sudo true") == 0: sys.path.append(str(BINDIR)) pythonpath = ":".join(sys.path) return ["sudo", "-E", "PYTHONDIR=%s" % pythonpath] - elif os.system("gosu root true") == 0: - return ["gosu", "root"] else: assert False, "cannot become root"