Exemple #1
0
 def test_alpha_kubelet_config_enable_dynamic_params(self):
     """
     Test kuebadm.alpha_kubelet_config_enable_dynamic 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_enable_dynamic(
             "node-1",
             kubeconfig="/kube.cfg",
             kubelet_version="version",
             rootfs="/mnt",
         ) == "stdout")
         salt_mock["cmd.run_all"].assert_called_with([
             "kubeadm",
             "alpha",
             "kubelet",
             "config",
             "enable-dynamic",
             "--node-name",
             "node-1",
             "--kubeconfig",
             "/kube.cfg",
             "--kubelet-version",
             "version",
             "--rootfs",
             "/mnt",
         ])
Exemple #2
0
 def test_alpha_kubelet_config_enable_dynamic_error(self):
     '''
     Test kuebadm.alpha_kubelet_config_enable_dynamic 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_enable_dynamic('node-1')
Exemple #3
0
 def test_alpha_kubelet_config_enable_dynamic_error(self):
     """
     Test kuebadm.alpha_kubelet_config_enable_dynamic 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_enable_dynamic("node-1")
Exemple #4
0
 def test_alpha_kubelet_config_enable_dynamic(self):
     '''
     Test kuebadm.alpha_kubelet_config_enable_dynamic without parameters
     '''
     result = {'retcode': 0, 'stdout': 'stdout'}
     salt_mock = {
         'cmd.run_all': MagicMock(return_value=result),
     }
     with patch.dict(kubeadm.__salt__, salt_mock):
         result = kubeadm.alpha_kubelet_config_enable_dynamic('node-1')
         assert result == 'stdout'
         salt_mock['cmd.run_all'].assert_called_with([
             'kubeadm', 'alpha', 'kubelet', 'config', 'enable-dynamic',
             '--node-name', 'node-1'
         ])
Exemple #5
0
 def test_alpha_kubelet_config_enable_dynamic_params(self):
     '''
     Test kuebadm.alpha_kubelet_config_enable_dynamic 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_enable_dynamic(
             'node-1',
             kubeconfig='/kube.cfg',
             kubelet_version='version',
             rootfs='/mnt') == 'stdout'
         salt_mock['cmd.run_all'].assert_called_with([
             'kubeadm', 'alpha', 'kubelet', 'config', 'enable-dynamic',
             '--node-name', 'node-1', '--kubeconfig', '/kube.cfg',
             '--kubelet-version', 'version', '--rootfs', '/mnt'
         ])
Exemple #6
0
 def test_alpha_kubelet_config_enable_dynamic(self):
     """
     Test kuebadm.alpha_kubelet_config_enable_dynamic without parameters
     """
     result = {"retcode": 0, "stdout": "stdout"}
     salt_mock = {
         "cmd.run_all": MagicMock(return_value=result),
     }
     with patch.dict(kubeadm.__salt__, salt_mock):
         result = kubeadm.alpha_kubelet_config_enable_dynamic("node-1")
         assert result == "stdout"
         salt_mock["cmd.run_all"].assert_called_with([
             "kubeadm",
             "alpha",
             "kubelet",
             "config",
             "enable-dynamic",
             "--node-name",
             "node-1",
         ])