Exemple #1
0
 def test_helm_check(self, mock_execute, mock_print, mock_log, mock_sleep):
     mock_execute.side_effect = [("Pending", None), ("Running", None)]  # Get states
     pod_check("a-namespace", "an-identifier", sleep_interval=15)
     assert mock_execute.call_count == 2
     mock_log.info.assert_has_calls(
         [call("Ensuring that all pods are running "), call("All pods are running")]
     )
     mock_print.assert_called_once_with(".", end="", flush=True)
     mock_sleep.assert_called_once_with(15)
Exemple #2
0
def helm_check(app, release, namespace, pod_num=None):
    """Check if a Helm release exists and is functional.

    Args:
        app (str): Helm application name.
        release (str): Release name on K8S.
        namespace (str): Namespace where Helm deployment is located.
        pod_num (int): Number of pods expected to exist in the release.
    """
    identifier = '-l "app={app},release={name}"'.format(app=app, name=release)
    pod_check(namespace, identifier, pod_num=pod_num)
Exemple #3
0
 def test_pod_check_podnum(self, mock_execute, mock_print, mock_sleep):
     mock_execute.side_effect = [
         ("Pending Running", None),  # Get states
         ("Running Running", None),
     ]
     pod_check("a-namespace", "an_identifier", pod_num=2)
     assert mock_execute.call_count == 2
     mock_print.assert_has_calls([
         call("Ensuring that all pods are running "),
         call(".", end="", flush=True),
         call("All pods are running"),
     ])
     mock_sleep.assert_called_once_with(10)