From 8526a071909f32835ca04d4114a77c486f936e29 Mon Sep 17 00:00:00 2001 From: paul luse Date: Tue, 19 Aug 2014 07:10:06 -0700 Subject: [PATCH] Fix sporadic false failure in xprofile unit test code (master) Same fix as is going through on feature/ec, fixed it there first as it was happening often and no point in waiting until EC is complete before getting it over to master... Appears that what's been happening on feature/ec lately with a middleware failure has to do with a hardcoded PID in the test code itself causing a profile file to exist when its not expected to by the test. Test code used a PID of 135 and based on how get_logfiles() is written, any real PID that starts with 135 will cause a false failure in test_call(). This can be seen via inspection and confirmed in logfiles where all captured assertions show a profile filename beginning with 135. Tried getting smarter about choosing a fake PID (int) but then decided it was 100% safe to use 'ABC' for this test since that'll never show up! Change-Id: I958f1525c2727b3fb3f533242fa509fa8e59926c --- test/unit/common/middleware/test_xprofile.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/unit/common/middleware/test_xprofile.py b/test/unit/common/middleware/test_xprofile.py index b49c2c7c05..0e8bd0bb44 100644 --- a/test/unit/common/middleware/test_xprofile.py +++ b/test/unit/common/middleware/test_xprofile.py @@ -164,7 +164,8 @@ class TestProfileMiddleware(unittest.TestCase): resp = self.app(env2, self.start_response) self.assertEqual(self.got_statuses, ['405 Method Not Allowed'], resp) - wsgi_input = StringIO.StringIO(body + '&profile=135&download=download') + # use a totally bogus profile identifier + wsgi_input = StringIO.StringIO(body + '&profile=ABC&download=download') environ['wsgi.input'] = wsgi_input resp = self.app(environ, self.start_response) self.assertEqual(self.got_statuses, ['404 Not Found'], resp)