fix monitoring spec errors

This commit is contained in:
Michael Jerger 2024-08-30 16:57:22 +02:00
parent 0d9324017d
commit 2e39383a04
3 changed files with 10 additions and 6 deletions

View file

@ -1,17 +1,15 @@
(ns dda.backup.monitoring.domain (ns dda.backup.monitoring.domain
(:require (:require
[dda.backup.restic.domain :as rd] [dda.backup.restic.domain :as rd]
[dda.backup.monitoring.element :as e]
[orchestra.core :refer [defn-spec]] [orchestra.core :refer [defn-spec]]
[clojure.spec.alpha :as s])) [clojure.spec.alpha :as s]))
(s/def ::type #{"gauge"}) (s/def ::type #{"gauge"})
(s/def ::labels map?) (s/def ::value (s/+ ::e/metric-element))
(s/def ::metric-value pos?)
(s/def ::metric-element (s/keys :req-un [::labels ::metric-value]))
(s/def ::value (s/+ ::metric-element))
(s/def ::metric (s/keys :req-un [::type (s/def ::metric (s/keys :req-un [::type
::value])) ::value]))
(s/def ::backup-size (s/spec ::metric-value)) (s/def ::backup-size (s/spec ::e/value))
(s/def ::docstring string?) (s/def ::docstring string?)
(s/def ::__name__ string?) (s/def ::__name__ string?)

View file

@ -0,0 +1,7 @@
(ns dda.backup.monitoring.element
(:require
[clojure.spec.alpha :as s]))
(s/def ::labels map?)
(s/def ::value pos?)
(s/def ::metric-element (s/keys :req-un [::labels ::value]))

View file

@ -1,7 +1,6 @@
(ns dda.backup.monitoring.domain-test (ns dda.backup.monitoring.domain-test
(:require (:require
[clojure.test :refer [deftest is are testing run-tests]] [clojure.test :refer [deftest is are testing run-tests]]
[orchestra.spec.test :as st]
[dda.backup.monitoring.domain :as cut])) [dda.backup.monitoring.domain :as cut]))
(deftest should-generate-monitoring-data (deftest should-generate-monitoring-data