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 12:40:35 +00:00
|
|
|
(st/instrument `cut/list-snapshot-command)
|
2024-08-16 10:32:59 +00:00
|
|
|
|
|
|
|
(deftest should-calculate-init-repo-command
|
2024-08-16 12:40:35 +00:00
|
|
|
(is (= [["restic" "-r" "repo/dir" "--cacert" "ca" "-v" "init"]]
|
2024-08-16 10:32:59 +00:00
|
|
|
(cut/init-repo-command {:certificate-file "ca"
|
|
|
|
:restic-repository "repo"
|
2024-08-16 12:40:35 +00:00
|
|
|
:backup-path "dir"})))
|
|
|
|
(is (= [["restic" "-r" "repo/dir" "-v" "init"]]
|
2024-08-16 10:32:59 +00:00
|
|
|
(cut/init-repo-command {:restic-repository "repo"
|
2024-08-16 12:40:35 +00:00
|
|
|
:backup-path "dir"}))))
|
|
|
|
|
|
|
|
(deftest should-calculate-list-snapshot-command
|
|
|
|
(is (= [["restic" "-r" "repo/dir" "--cacert" "ca" "-v" "snapshots"]]
|
|
|
|
(cut/list-snapshot-command {:certificate-file "ca"
|
|
|
|
:restic-repository "repo"
|
|
|
|
:backup-path "dir"})))
|
|
|
|
(is (= [["restic" "-r" "repo/dir" "--password-file" "password" "-v" "snapshots"]]
|
|
|
|
(cut/list-snapshot-command {:password-file "password"
|
|
|
|
:restic-repository "repo"
|
|
|
|
:backup-path "dir"})))
|
|
|
|
(is (= [["restic" "-r" "repo/dir" "-v" "snapshots"]]
|
|
|
|
(cut/list-snapshot-command {:restic-repository "repo"
|
|
|
|
:backup-path "dir"}))))
|