diff options
author | Jenkins <jenkins@review.openstack.org> | 2013-06-12 22:00:04 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2013-06-12 22:00:04 +0000 |
commit | fb13686a00e933c17bca163b51fb3d7119d34e5a (patch) | |
tree | 35abd4ff5686b515ddb7753536e2571f2c286f1f /tests | |
parent | f9cc093ab6c3f34bd2f3bceb831ba6b937704a54 (diff) | |
parent | 8b95b1e91d46f1bc7a37d210dc15e6f4072afaaa (diff) | |
download | oslo-fb13686a00e933c17bca163b51fb3d7119d34e5a.tar.gz oslo-fb13686a00e933c17bca163b51fb3d7119d34e5a.tar.xz oslo-fb13686a00e933c17bca163b51fb3d7119d34e5a.zip |
Merge "Handle relative path arguments in Killfilter"
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/test_rootwrap.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/unit/test_rootwrap.py b/tests/unit/test_rootwrap.py index 25b2051..0e08b5e 100644 --- a/tests/unit/test_rootwrap.py +++ b/tests/unit/test_rootwrap.py @@ -107,6 +107,20 @@ class RootwrapTestCase(utils.BaseTestCase): usercmd = ['kill', p.pid] # Providing no signal should work self.assertTrue(f.match(usercmd) or f2.match(usercmd)) + + # verify that relative paths are matched against $PATH + f = filters.KillFilter("root", "cat") + # Our own PID does not match so it should fail + usercmd = ['kill', os.getpid()] + self.assertFalse(f.match(usercmd)) + # Filter should find cat in /bin or /usr/bin + usercmd = ['kill', p.pid] + self.assertTrue(f.match(usercmd)) + # Filter shouldn't be able to find binary in $PATH, so fail + with fixtures.EnvironmentVariable("PATH", "/foo:/bar"): + self.assertFalse(f.match(usercmd)) + pass + finally: # Terminate the "cat" process and wait for it to finish p.terminate() |