60 lines
1.7 KiB
Diff
60 lines
1.7 KiB
Diff
From fa7e547053fc5bf7f26081558176fd2fcdee21f6 Mon Sep 17 00:00:00 2001
|
|
From: Ondrej Mular <omular@redhat.com>
|
|
Date: Sat, 29 Sep 2018 00:16:12 +0200
|
|
Subject: [PATCH 3/4] skip tests which require root user
|
|
|
|
---
|
|
pcs/test/test_cluster.py | 4 +++-
|
|
pcs/test/tools/misc.py | 6 ++++++
|
|
2 files changed, 9 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/pcs/test/test_cluster.py b/pcs/test/test_cluster.py
|
|
index deff5160..eab81e00 100644
|
|
--- a/pcs/test/test_cluster.py
|
|
+++ b/pcs/test/test_cluster.py
|
|
@@ -11,6 +11,7 @@ from pcs.test.tools.assertions import (
|
|
from pcs.test.tools.misc import (
|
|
get_test_resource as rc,
|
|
skip_unless_pacemaker_version,
|
|
+ skip_unless_root,
|
|
)
|
|
from pcs.test.tools.pcs_runner import (
|
|
pcs,
|
|
@@ -140,7 +141,7 @@ class ClusterUpgradeTest(unittest.TestCase, AssertPcsMixin):
|
|
assert r == 0
|
|
|
|
|
|
-
|
|
+@skip_unless_root()
|
|
class ClusterStartStop(unittest.TestCase, AssertPcsMixin):
|
|
def setUp(self):
|
|
self.pcs_runner = PcsRunner(cib_file=None)
|
|
@@ -156,6 +157,7 @@ class ClusterStartStop(unittest.TestCase, AssertPcsMixin):
|
|
)
|
|
|
|
|
|
+@skip_unless_root()
|
|
class ClusterEnableDisable(unittest.TestCase, AssertPcsMixin):
|
|
def setUp(self):
|
|
self.pcs_runner = PcsRunner(cib_file=None)
|
|
diff --git a/pcs/test/tools/misc.py b/pcs/test/tools/misc.py
|
|
index 23fd710a..7bfd3fba 100644
|
|
--- a/pcs/test/tools/misc.py
|
|
+++ b/pcs/test/tools/misc.py
|
|
@@ -154,6 +154,12 @@ def skip_unless_lsb_network_available():
|
|
"lsb:network resource agent is not available"
|
|
)
|
|
|
|
+def skip_unless_root():
|
|
+ return skipUnless(
|
|
+ os.getuid() == 0,
|
|
+ "Root user required"
|
|
+ )
|
|
+
|
|
def create_patcher(target_prefix_or_module):
|
|
"""
|
|
Return function for patching tests with preconfigured target prefix
|
|
--
|
|
2.18.0
|
|
|