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", ])
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()
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()
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'])
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"])
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' ])