dda-backup/test/dda/backup/management/domain_test.clj

33 lines
1.3 KiB
Clojure
Raw Normal View History

2024-08-16 10:32:59 +00:00
(ns dda.backup.management.domain-test
(:require
[clojure.test :refer [deftest is are testing run-tests]]
[clojure.spec.test.alpha :as st]
[dda.backup.management.domain :as cut]))
(st/instrument `cut/init-repo-command)
2024-08-16 14:29:19 +00:00
(st/instrument `cut/unlock-repo-command)
2024-08-16 15:36:28 +00:00
(st/instrument `cut/forget-command)
2024-08-16 14:29:19 +00:00
(deftest should-calculate-init-repo-command
(is (= [["restic" "-r" "repo/dir" "-v" "init"]]
(cut/init-repo-command {:restic-repository "repo"
2024-08-16 15:36:28 +00:00
:backup-path "dir"
:days-to-keep 39
:months-to-keep 3}))))
2024-08-16 14:29:19 +00:00
(deftest should-calculate-unlock-repo-command
(is (= [["restic" "-r" "repo/dir" "-v" "--cleanup-cache" "unlock"]]
(cut/unlock-repo-command {:restic-repository "repo"
2024-08-16 15:36:28 +00:00
:backup-path "dir"
:days-to-keep 39
:months-to-keep 3}))))
(deftest should-calculate-forget-command
(is (= [["restic" "-r" "repo/dir" "-v" "forget"
"--group-by" "''" "--keep-last" "1"
"--keep-daily" "39" "--keep-monthly" "3" "--prune"]]
(cut/forget-command {:restic-repository "repo"
:backup-path "dir"
:days-to-keep 39
:months-to-keep 3}))))