コード例 #1
0
 def test_version(self):
     '''
     Test kuebadm.version without parameters
     '''
     version = '{"clientVersion":{"major":"1"}}'
     salt_mock = {
         'cmd.run_stdout': MagicMock(return_value=version),
     }
     with patch.dict(kubeadm.__salt__, salt_mock):
         assert kubeadm.version() == {'clientVersion': {'major': '1'}}
         salt_mock['cmd.run_stdout'].assert_called_with(
             ['kubeadm', 'version', '--output', 'json'])
コード例 #2
0
 def test_version(self):
     """
     Test kuebadm.version without parameters
     """
     version = '{"clientVersion":{"major":"1"}}'
     salt_mock = {
         "cmd.run_stdout": MagicMock(return_value=version),
     }
     with patch.dict(kubeadm.__salt__, salt_mock):
         assert kubeadm.version() == {"clientVersion": {"major": "1"}}
         salt_mock["cmd.run_stdout"].assert_called_with(
             ["kubeadm", "version", "--output", "json"])
コード例 #3
0
 def test_version_params(self):
     """
     Test kuebadm.version with parameters
     """
     version = '{"clientVersion":{"major":"1"}}'
     salt_mock = {
         "cmd.run_stdout": MagicMock(return_value=version),
     }
     with patch.dict(kubeadm.__salt__, salt_mock):
         assert kubeadm.version(kubeconfig="/kube.cfg", rootfs="/mnt") == {
             "clientVersion": {
                 "major": "1"
             }
         }
         salt_mock["cmd.run_stdout"].assert_called_with([
             "kubeadm",
             "version",
             "--kubeconfig",
             "/kube.cfg",
             "--rootfs",
             "/mnt",
             "--output",
             "json",
         ])