fix tests

This commit is contained in:
Clemens 2024-07-17 11:02:37 +02:00
parent ca8ab8d708
commit 52e3ba6ae1
3 changed files with 11 additions and 8 deletions

View file

@ -26,7 +26,7 @@
"monitoring/node-exporter-service.yaml" (rc/inline "monitoring/node-exporter-service.yaml")
"monitoring/prometheus-cluster-role-binding.yaml" (rc/inline "monitoring/prometheus-cluster-role-binding.yaml")
"monitoring/prometheus-cluster-role.yaml" (rc/inline "monitoring/prometheus-cluster-role.yaml")
"monitoring/prometheus-config.yaml" (rc/inline "monitoring/prometheus-config.yaml")
"monitoring/prometheus-config-secret.yaml" (rc/inline "monitoring/prometheus-config-secret.yaml")
"monitoring/prometheus-deployment.yaml" (rc/inline "monitoring/prometheus-deployment.yaml")
"monitoring/prometheus-prometheus.yaml" (rc/inline "monitoring/prometheus-prometheus.yaml")
"monitoring/prometheus-service-account.yaml" (rc/inline "monitoring/prometheus-service-account.yaml")

View file

@ -8,7 +8,7 @@
(st/instrument `cut/generate-stateful-set)
(st/instrument `cut/generate-agent-config)
(st/instrument `cut/generate-config)
(st/instrument `cut/generate-config-secret)
(def conf {:cluster-name "clustername"
:cluster-stage "test"
@ -29,12 +29,12 @@
(deftest should-not-generate-config
(is (thrown?
#?(:clj Exception :cljs js/Error)
(cut/generate-config invalid-conf auth))))
(cut/generate-config-secret invalid-conf auth))))
(deftest should-not-generate-auth
(is (thrown?
#?(:clj Exception :cljs js/Error)
(cut/generate-config conf invalid-auth))))
(cut/generate-config-secret conf invalid-auth))))
(deftest should-generate-prometheus-remote-write-auth
@ -54,6 +54,6 @@
(deftest should-generate-config
(is (str/starts-with?
(get-in
(cut/generate-config conf auth)
(cut/generate-config-secret conf auth)
[:stringData :prometheus.yaml])
"global:\n scrape_interval:")))

View file

@ -5,7 +5,8 @@
[clojure.spec.test.alpha :as st]
[dda.c4k-common.monitoring :as cut]))
(st/instrument `cut/generate)
(st/instrument `cut/generate-config)
(st/instrument `cut/generate-auth)
(def conf {:cluster-name "clustername"
:cluster-stage "test"
@ -17,5 +18,7 @@
(deftest should-generate
(is (= 17
(count (cut/generate conf auth)))))
(is (= 16
(count (cut/generate-config conf auth))))
(is (= 1
(count (cut/generate-auth conf auth)))))