Merge "Fix failure of testing privsep"

This commit is contained in:
Zuul
2022-03-19 00:31:13 +00:00
committed by Gerrit Code Review
2 changed files with 7 additions and 4 deletions

View File

@@ -22,7 +22,7 @@ from oslo_privsep import priv_context
default = priv_context.PrivContext(
__name__,
cfg_section='privsep',
pypath="f{__name__}.default",
pypath=__name__ + '.default',
capabilities=[caps.CAP_SYS_ADMIN,
caps.CAP_NET_ADMIN,
caps.CAP_DAC_OVERRIDE,

View File

@@ -43,7 +43,8 @@ class PrivsepTest(base.BaseTestCase):
def setUp(self):
super(PrivsepTest, self).setUp()
@unittest.skipIf(_PWD == _PWD_ZUUL, "Failed on zuul for root priv")
@unittest.skipIf(_PWD == _PWD_ZUUL or os.getlogin() != 'stack',
"Failed on zuul or non-devstack env for root privilege")
def test_privsep_ls(self):
"""Run ls with root privilege
@@ -58,7 +59,8 @@ class PrivsepTest(base.BaseTestCase):
# 'boot' dir must be under '/'.
self.assertIn('boot', res)
@unittest.skipIf(_PWD == _PWD_ZUUL, "Failed on zuul for root priv")
@unittest.skipIf(_PWD == _PWD_ZUUL or os.getlogin() != 'stack',
"Failed on zuul or non-devstack env for root privilege")
def test_privsep_pwd(self):
"""Run pwd with root privilege
@@ -67,7 +69,8 @@ class PrivsepTest(base.BaseTestCase):
res = tacker.privileged.linux_cmd.pwd()[0]
self.assertEqual('/\n', res)
@unittest.skipIf(_PWD == _PWD_ZUUL, "Failed on zuul for root priv")
@unittest.skipIf(_PWD == _PWD_ZUUL or os.getlogin() != 'stack',
"Failed on zuul or non-devstack env for root privilege")
def test_rootwrap(self):
"""Confirm a command can be run with tacker-rootwrap