예제 #1
0
 def test_alpha_kubelet_config_download_params(self):
     """
     Test kuebadm.alpha_kubelet_config_download with parameters
     """
     result = {"retcode": 0, "stdout": "stdout"}
     salt_mock = {
         "cmd.run_all": MagicMock(return_value=result),
     }
     with patch.dict(kubeadm.__salt__, salt_mock):
         assert (kubeadm.alpha_kubelet_config_download(
             kubeconfig="/kube.cfg",
             kubelet_version="version",
             rootfs="/mnt") == "stdout")
         salt_mock["cmd.run_all"].assert_called_with([
             "kubeadm",
             "alpha",
             "kubelet",
             "config",
             "download",
             "--kubeconfig",
             "/kube.cfg",
             "--kubelet-version",
             "version",
             "--rootfs",
             "/mnt",
         ])
예제 #2
0
 def test_alpha_kubelet_config_download_error(self):
     '''
     Test kuebadm.alpha_kubelet_config_download error
     '''
     result = {'retcode': 1, 'stderr': 'error'}
     salt_mock = {
         'cmd.run_all': MagicMock(return_value=result),
     }
     with patch.dict(kubeadm.__salt__, salt_mock):
         with pytest.raises(CommandExecutionError):
             assert kubeadm.alpha_kubelet_config_download()
예제 #3
0
 def test_alpha_kubelet_config_download_error(self):
     """
     Test kuebadm.alpha_kubelet_config_download error
     """
     result = {"retcode": 1, "stderr": "error"}
     salt_mock = {
         "cmd.run_all": MagicMock(return_value=result),
     }
     with patch.dict(kubeadm.__salt__, salt_mock):
         with pytest.raises(CommandExecutionError):
             assert kubeadm.alpha_kubelet_config_download()
예제 #4
0
 def test_alpha_kubelet_config_download(self):
     '''
     Test kuebadm.alpha_kubelet_config_download without parameters
     '''
     result = {'retcode': 0, 'stdout': 'stdout'}
     salt_mock = {
         'cmd.run_all': MagicMock(return_value=result),
     }
     with patch.dict(kubeadm.__salt__, salt_mock):
         assert kubeadm.alpha_kubelet_config_download() == 'stdout'
         salt_mock['cmd.run_all'].assert_called_with(
             ['kubeadm', 'alpha', 'kubelet', 'config', 'download'])
예제 #5
0
 def test_alpha_kubelet_config_download(self):
     """
     Test kuebadm.alpha_kubelet_config_download without parameters
     """
     result = {"retcode": 0, "stdout": "stdout"}
     salt_mock = {
         "cmd.run_all": MagicMock(return_value=result),
     }
     with patch.dict(kubeadm.__salt__, salt_mock):
         assert kubeadm.alpha_kubelet_config_download() == "stdout"
         salt_mock["cmd.run_all"].assert_called_with(
             ["kubeadm", "alpha", "kubelet", "config", "download"])
예제 #6
0
 def test_alpha_kubelet_config_download_params(self):
     '''
     Test kuebadm.alpha_kubelet_config_download with parameters
     '''
     result = {'retcode': 0, 'stdout': 'stdout'}
     salt_mock = {
         'cmd.run_all': MagicMock(return_value=result),
     }
     with patch.dict(kubeadm.__salt__, salt_mock):
         assert kubeadm.alpha_kubelet_config_download(
             kubeconfig='/kube.cfg',
             kubelet_version='version',
             rootfs='/mnt') == 'stdout'
         salt_mock['cmd.run_all'].assert_called_with([
             'kubeadm', 'alpha', 'kubelet', 'config', 'download',
             '--kubeconfig', '/kube.cfg', '--kubelet-version', 'version',
             '--rootfs', '/mnt'
         ])