def check_cluster(cluster_name): """Check that we are using the correct K8S cluster. Args: cluster_name (str): Name of K8S cluster. """ context = context_get() if context["context"]["cluster"] != cluster_name: message = f"We expect to use cluster {cluster_name}, but are instead using cluster {context['context']['cluster']}", raise ValueError(message)
def check_cluster(cluster_name): """Check that we are using the correct K8S cluster. Args: cluster_name (str): Name of K8S cluster. """ context = context_get() if context["context"]["cluster"] != cluster_name: message = "We expect to use cluster {}, but are instead using cluster {}".format( cluster_name, context["context"]["cluster"]) raise ValueError(message)
def test_context_get_verbose(self, mock_config, mock_pretty_print): mock_config.list_kube_config_contexts.side_effect = [self.CONTEXTS] context = context_get(verbose=True) mock_config.list_kube_config_contexts.assert_called_once_with() mock_pretty_print.assert_called_once() assert context == self.CONTEXTS[1]
def check_cluster(cluster_name): context = context_get() if context['context']['cluster'] != cluster_name: message = 'We expect to use cluster {}, but are instead using cluster {}'.format( cluster_name, context['context']['cluster']) raise ValueError(message)