Skip to content

Commit becb3ff

Browse files
matthewolivertipabu
authored andcommitted
tests: Attempt to use configured tmp in xprofile tests
My home server has more strict controls on /tmp as it run selinux etc. When running unittests and the default log_filename_prefix deep under /tmp gets permission denied. It would be better to override this setting in the tests with a good known tmp location Change-Id: I6c95ca3a0045a8f268802c6abb633bdfb0e56b73
1 parent e6b7361 commit becb3ff

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

test/unit/common/middleware/test_xprofile.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,12 @@ class TestProfileMiddleware(unittest.TestCase):
8383
@unittest.skipIf(xprofile is None, "can't import xprofile")
8484
def setUp(self):
8585
self.got_statuses = []
86-
self.app = ProfileMiddleware(FakeApp, {})
87-
self.tempdir = os.path.dirname(self.app.log_filename_prefix)
86+
self.tempdir = tempfile.mkdtemp()
87+
log_filename_prefix = os.path.join(
88+
self.tempdir,
89+
'log/swift/profile/default.profile')
90+
conf = {'log_filename_prefix': log_filename_prefix}
91+
self.app = ProfileMiddleware(FakeApp, conf)
8892
self.pids = ['123', '456', str(os.getpid())]
8993
profiler = xprofile.get_profiler('eventlet.green.profile')
9094
for pid in self.pids:

0 commit comments

Comments
 (0)