コード例 #1
0
    def test_default_config_legacy(self, aggregator, mock_read_bearer_token):
        """
        Testing the default legacy configuration.
        """
        check = KubeAPIServerMetricsCheck('kube_apiserver_metrics', {}, [minimal_instance_legacy])
        check.process = mock.MagicMock()
        check.check(minimal_instance_legacy)

        apiserver_instance = check.kube_apiserver_config

        assert not apiserver_instance["ssl_verify"]
        assert apiserver_instance["bearer_token_auth"]
        assert apiserver_instance["prometheus_url"] == "https://localhost:443/metrics"
コード例 #2
0
    def test_check(self, aggregator, mock_get):
        """
        Testing kube_apiserver_metrics check.
        """

        check = KubeAPIServerMetricsCheck('kube_apiserver_metrics', {}, {}, [instance])
        check.check(instance)

        # check that we then get the count metrics also
        check.check(instance)

        for metric in self.METRICS + self.COUNT_METRICS:
            aggregator.assert_metric(metric)
            aggregator.assert_metric_has_tag(metric, customtag)
        aggregator.assert_all_metrics_covered()