diff --git a/tests/prometheus/prometheus.yaml b/tests/prometheus/prometheus.yaml index a019b61ac8bf169c433bb950d0abc5132d6eab2e..958e8cac099127b2ec6053db09bc03b3f5a21be8 100644 --- a/tests/prometheus/prometheus.yaml +++ b/tests/prometheus/prometheus.yaml @@ -21,7 +21,7 @@ tests: apiVersion: "monitoring.coreos.com/v1" name: it-monit-metrics-collector-prometheus not: true - - it: should be deployed with cluster-local remote write by default + - it: should be deployed with cluster-local remote write by default and k8s_cluster_name set set: kubernetes.clusterName: test asserts: @@ -35,6 +35,21 @@ tests: - equal: path: spec.remoteWrite[0].url value: "http://it-monit-metrics-fluentbit:8080/api/prom/push" + - equal: + path: spec.externalLabels.k8s_cluster_name + value: test + - it: extra labels for metrics are honoured + set: + kubernetes.clusterName: test + metrics.prometheus.server.extraLabelsForMetrics: + test: bar + asserts: + - equal: + path: spec.externalLabels.k8s_cluster_name + value: test + - equal: + path: spec.externalLabels.test + value: bar - it: should be deployed with no remoteWrites if no fluentbit is available set: kubernetes.clusterName: test @@ -47,7 +62,7 @@ tests: - lengthEqual: path: spec.remoteWrite count: 0 - - it: should be deployed with external remote write if configured + - it: should be deployed with external remote write if configured and no external labels set: kubernetes.clusterName: test metrics.fluentbit.enabled: false @@ -70,6 +85,8 @@ tests: password: name: it-monit-metrics-collector-prometheus key: password + - isNullOrEmpty: + path: spec.externalLabels - lengthEqual: path: spec.remoteWrite count: 1