@@ -226,7 +226,9 @@ def test_check_required_global_args(self):
226226
227227 @mock .patch ('cephadm.logger' )
228228 def test_parse_mem_usage (self , _logger ):
229- len , summary = _cephadm ._parse_mem_usage (0 , 'c6290e3f1489,-- / --' )
229+ from cephadmlib .container_engines import _parse_mem_usage
230+
231+ len , summary = _parse_mem_usage (0 , 'c6290e3f1489,-- / --' )
230232 assert summary == {}
231233
232234 def test_CustomValidation (self ):
@@ -1665,7 +1667,9 @@ def test_fsid(self, fsid, err, cephadm_fs, funkypatch):
16651667
16661668class TestShell (object ):
16671669
1668- def test_fsid (self , cephadm_fs ):
1670+ def test_fsid (self , cephadm_fs , funkypatch ):
1671+ _call = funkypatch .patch ('cephadmlib.call_wrappers.call' , force = True )
1672+ _call .side_effect = lambda * args , ** kwargs : ('' , '' , 0 )
16691673 fsid = '00000000-0000-0000-0000-0000deadbeef'
16701674
16711675 cmd = ['shell' , '--fsid' , fsid ]
@@ -1699,7 +1703,10 @@ def test_fsid(self, cephadm_fs):
16991703 assert retval == 1
17001704 assert ctx .fsid == None
17011705
1702- def test_name (self , cephadm_fs ):
1706+ def test_name (self , cephadm_fs , funkypatch ):
1707+ _call = funkypatch .patch ('cephadmlib.call_wrappers.call' , force = True )
1708+ _call .side_effect = lambda * args , ** kwargs : ('' , '' , 0 )
1709+
17031710 cmd = ['shell' , '--name' , 'foo' ]
17041711 with with_cephadm_ctx (cmd ) as ctx :
17051712 retval = _cephadm .command_shell (ctx )
@@ -1718,7 +1725,10 @@ def test_name(self, cephadm_fs):
17181725 retval = _cephadm .command_shell (ctx )
17191726 assert retval == 0
17201727
1721- def test_config (self , cephadm_fs ):
1728+ def test_config (self , cephadm_fs , funkypatch ):
1729+ _call = funkypatch .patch ('cephadmlib.call_wrappers.call' , force = True )
1730+ _call .side_effect = lambda * args , ** kwargs : ('' , '' , 0 )
1731+
17221732 cmd = ['shell' ]
17231733 with with_cephadm_ctx (cmd ) as ctx :
17241734 retval = _cephadm .command_shell (ctx )
@@ -1737,7 +1747,10 @@ def test_config(self, cephadm_fs):
17371747 assert retval == 0
17381748 assert ctx .config == 'foo'
17391749
1740- def test_keyring (self , cephadm_fs ):
1750+ def test_keyring (self , cephadm_fs , funkypatch ):
1751+ _call = funkypatch .patch ('cephadmlib.call_wrappers.call' , force = True )
1752+ _call .side_effect = lambda * args , ** kwargs : ('' , '' , 0 )
1753+
17411754 cmd = ['shell' ]
17421755 with with_cephadm_ctx (cmd ) as ctx :
17431756 retval = _cephadm .command_shell (ctx )
@@ -1756,24 +1769,33 @@ def test_keyring(self, cephadm_fs):
17561769 assert retval == 0
17571770 assert ctx .keyring == 'foo'
17581771
1759- @mock .patch ('cephadm.CephContainer' )
1760- def test_mount_no_dst (self , _ceph_container , cephadm_fs ):
1772+ def test_mount_no_dst (self , cephadm_fs , funkypatch ):
1773+ _ceph_container = funkypatch .patch ('cephadm.CephContainer' )
1774+ _call = funkypatch .patch ('cephadmlib.call_wrappers.call' , force = True )
1775+ _call .side_effect = lambda * args , ** kwargs : ('' , '' , 0 )
1776+
17611777 cmd = ['shell' , '--mount' , '/etc/foo' ]
17621778 with with_cephadm_ctx (cmd ) as ctx :
17631779 retval = _cephadm .command_shell (ctx )
17641780 assert retval == 0
17651781 assert _ceph_container .call_args .kwargs ['volume_mounts' ]['/etc/foo' ] == '/mnt/foo'
17661782
1767- @mock .patch ('cephadm.CephContainer' )
1768- def test_mount_with_dst_no_opt (self , _ceph_container , cephadm_fs ):
1783+ def test_mount_with_dst_no_opt (self , cephadm_fs , funkypatch ):
1784+ _ceph_container = funkypatch .patch ('cephadm.CephContainer' )
1785+ _call = funkypatch .patch ('cephadmlib.call_wrappers.call' , force = True )
1786+ _call .side_effect = lambda * args , ** kwargs : ('' , '' , 0 )
1787+
17691788 cmd = ['shell' , '--mount' , '/etc/foo:/opt/foo/bar' ]
17701789 with with_cephadm_ctx (cmd ) as ctx :
17711790 retval = _cephadm .command_shell (ctx )
17721791 assert retval == 0
17731792 assert _ceph_container .call_args .kwargs ['volume_mounts' ]['/etc/foo' ] == '/opt/foo/bar'
17741793
1775- @mock .patch ('cephadm.CephContainer' )
1776- def test_mount_with_dst_and_opt (self , _ceph_container , cephadm_fs ):
1794+ def test_mount_with_dst_and_opt (self , cephadm_fs , funkypatch ):
1795+ _ceph_container = funkypatch .patch ('cephadm.CephContainer' )
1796+ _call = funkypatch .patch ('cephadmlib.call_wrappers.call' , force = True )
1797+ _call .side_effect = lambda * args , ** kwargs : ('' , '' , 0 )
1798+
17771799 cmd = ['shell' , '--mount' , '/etc/foo:/opt/foo/bar:Z' ]
17781800 with with_cephadm_ctx (cmd ) as ctx :
17791801 retval = _cephadm .command_shell (ctx )
@@ -1790,7 +1812,10 @@ def _get_cmd(*args):
17901812 '--' , 'inventory' , '--format' , 'json'
17911813 ]
17921814
1793- def test_noop (self , cephadm_fs ):
1815+ def test_noop (self , cephadm_fs , funkypatch ):
1816+ _call = funkypatch .patch ('cephadmlib.call_wrappers.call' , force = True )
1817+ _call .side_effect = lambda * args , ** kwargs : ('' , '' , 0 )
1818+
17941819 cmd = self ._get_cmd ()
17951820 with with_cephadm_ctx (cmd ) as ctx :
17961821 _cephadm .command_ceph_volume (ctx )
@@ -1799,7 +1824,10 @@ def test_noop(self, cephadm_fs):
17991824 assert ctx .keyring == None
18001825 assert ctx .config_json == None
18011826
1802- def test_fsid (self , cephadm_fs ):
1827+ def test_fsid (self , cephadm_fs , funkypatch ):
1828+ _call = funkypatch .patch ('cephadmlib.call_wrappers.call' , force = True )
1829+ _call .side_effect = lambda * args , ** kwargs : ('' , '' , 0 )
1830+
18031831 fsid = '00000000-0000-0000-0000-0000deadbeef'
18041832
18051833 cmd = self ._get_cmd ('--fsid' , fsid )
@@ -1830,7 +1858,10 @@ def test_fsid(self, cephadm_fs):
18301858 _cephadm .command_ceph_volume (ctx )
18311859 assert ctx .fsid == None
18321860
1833- def test_config (self , cephadm_fs ):
1861+ def test_config (self , cephadm_fs , funkypatch ):
1862+ _call = funkypatch .patch ('cephadmlib.call_wrappers.call' , force = True )
1863+ _call .side_effect = lambda * args , ** kwargs : ('' , '' , 0 )
1864+
18341865 cmd = self ._get_cmd ('--config' , 'foo' )
18351866 with with_cephadm_ctx (cmd ) as ctx :
18361867 err = r'No such file or directory'
@@ -1843,7 +1874,10 @@ def test_config(self, cephadm_fs):
18431874 _cephadm .command_ceph_volume (ctx )
18441875 assert ctx .config == 'bar'
18451876
1846- def test_keyring (self , cephadm_fs ):
1877+ def test_keyring (self , cephadm_fs , funkypatch ):
1878+ _call = funkypatch .patch ('cephadmlib.call_wrappers.call' , force = True )
1879+ _call .side_effect = lambda * args , ** kwargs : ('' , '' , 0 )
1880+
18471881 cmd = self ._get_cmd ('--keyring' , 'foo' )
18481882 with with_cephadm_ctx (cmd ) as ctx :
18491883 err = r'No such file or directory'
@@ -2260,7 +2294,7 @@ def test_error(self, funkypatch):
22602294 funkypatch .patch ('cephadm.logger' )
22612295 _giifi = funkypatch .patch ('cephadm.get_image_info_from_inspect' )
22622296 _giifi .return_value = {}
2263- _call = funkypatch .patch ('cephadmlib.call_wrappers.call' )
2297+ _call = funkypatch .patch ('cephadmlib.call_wrappers.call' , force = True )
22642298 ctx = _cephadm .CephadmContext ()
22652299 ctx .container_engine = mock_podman ()
22662300 ctx .insecure = False
0 commit comments