]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: fix test test_selinuxenabled_doesnt_exist
authorJan Fajerski <jfajerski@suse.com>
Fri, 22 Nov 2019 10:09:22 +0000 (11:09 +0100)
committerJan Fajerski <jfajerski@suse.com>
Fri, 22 Nov 2019 14:33:00 +0000 (15:33 +0100)
Popen does not open a shell by default, so A FileNotFoundError is
raised instead of returning a 127 return code.

Signed-off-by: Jan Fajerski <jfajerski@suse.com>
(cherry picked from commit af30c7f956380beb3bc4021d60b9229a82bda4e2)

src/ceph-volume/ceph_volume/tests/util/test_system.py

index 808048a6a9c056bb72c55389f6cdfd8c92c6594a..ab4431295791e993d9ea2746396d87a3f3bc4a09 100644 (file)
@@ -4,6 +4,7 @@ import getpass
 import pytest
 from textwrap import dedent
 from ceph_volume.util import system
+from mock.mock import patch
 
 
 class TestMkdirP(object):
@@ -260,8 +261,9 @@ class TestSetContext(object):
         system.set_context('/tmp/foo')
         assert len(fake_run.calls)
 
-    def test_selinuxenabled_doesnt_exist(self, stub_call, fake_run):
-        stub_call(('', 'command not found: selinuxenabled', 127))
+    @patch('ceph_volume.process.call')
+    def test_selinuxenabled_doesnt_exist(self, mocked_call, fake_run):
+        mocked_call.side_effect = FileNotFoundError()
         system.set_context('/tmp/foo')
         assert fake_run.calls == []