reuse & rename core config
This commit is contained in:
parent
582138a645
commit
5d2ff87564
12 changed files with 182 additions and 171 deletions
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env bb
|
#!/usr/bin/env bb
|
||||||
|
|
||||||
(require '[babashka.tasks :as tasks]
|
(require '[babashka.tasks :as tasks]
|
||||||
'[dda.backup.management :as mgm]
|
'[dda.backup.restic :as rc]
|
||||||
'[dda.backup.postgresql :as pg]
|
'[dda.backup.postgresql :as pg]
|
||||||
'[dda.backup.backup :as bak]
|
'[dda.backup.backup :as bak]
|
||||||
'[dda.backup.restore :as rs])
|
'[dda.backup.restore :as rs])
|
||||||
|
@ -28,8 +28,8 @@
|
||||||
(defn restic-repo-init!
|
(defn restic-repo-init!
|
||||||
[]
|
[]
|
||||||
(spit "restic-pwd" "ThePassword")
|
(spit "restic-pwd" "ThePassword")
|
||||||
(mgm/init! file-config)
|
(rc/init! file-config)
|
||||||
(mgm/init! (merge db-config dry-run)))
|
(rc/init! (merge db-config dry-run)))
|
||||||
|
|
||||||
(defn restic-backup!
|
(defn restic-backup!
|
||||||
[]
|
[]
|
||||||
|
|
|
@ -2,16 +2,16 @@
|
||||||
(:require
|
(:require
|
||||||
[orchestra.core :refer [defn-spec]]
|
[orchestra.core :refer [defn-spec]]
|
||||||
[clojure.spec.alpha :as s]
|
[clojure.spec.alpha :as s]
|
||||||
[dda.backup.core.domain :as cd]))
|
[dda.backup.core.domain :as cd]
|
||||||
|
[dda.backup.restic.domain :as rd]))
|
||||||
|
|
||||||
(s/def ::files (s/+ string?))
|
(s/def ::files (s/+ string?))
|
||||||
|
|
||||||
(s/def ::config
|
(s/def ::config
|
||||||
(s/keys :req-un [::files
|
(s/merge ::rd/config
|
||||||
::cd/restic-repository ::cd/backup-path]
|
(s/keys :req-un [::files])))
|
||||||
:opt-un [::cd/certificate-file ::cd/password-file ::cd/directory]))
|
|
||||||
|
|
||||||
(defn-spec backup-files-command ::cd/commands
|
(defn-spec backup-files-command ::cd/commands
|
||||||
[config ::config]
|
[config ::config]
|
||||||
(let [{:keys [files]} config]
|
(let [{:keys [files]} config]
|
||||||
[(cd/repo-command config (into ["backup"] files))]))
|
[(rd/repo-command config (into ["backup"] files))]))
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
(ns dda.backup.core
|
(ns dda.backup.core
|
||||||
(:require [clojure.spec.alpha :as s]
|
(:require
|
||||||
))
|
[clojure.spec.alpha :as s]))
|
||||||
|
|
||||||
(s/def ::dry-run boolean?)
|
|
||||||
(s/def ::debug boolean?)
|
|
||||||
|
|
||||||
(def default {:dry-run false
|
(def default {:dry-run false
|
||||||
:debug false
|
:debug false})
|
||||||
:days-to-keep 30
|
|
||||||
:months-to-keep 12})
|
(s/def ::execution
|
||||||
|
(s/keys :req-un []
|
||||||
|
:opt-un [::dry-run
|
||||||
|
::debug
|
||||||
|
::execution-directory]))
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
(ns dda.backup.core.domain
|
(ns dda.backup.core.domain
|
||||||
(:require
|
(:require
|
||||||
[orchestra.core :refer [defn-spec]]
|
|
||||||
[clojure.spec.alpha :as s]))
|
[clojure.spec.alpha :as s]))
|
||||||
|
|
||||||
(s/def ::command (s/cat
|
(s/def ::command (s/cat
|
||||||
|
@ -8,34 +7,10 @@
|
||||||
:params (s/* string?)))
|
:params (s/* string?)))
|
||||||
(s/def ::commands (s/coll-of ::command))
|
(s/def ::commands (s/coll-of ::command))
|
||||||
|
|
||||||
(s/def ::certificate-file string?)
|
(s/def ::dry-run boolean?)
|
||||||
(s/def ::password-file string?)
|
(s/def ::debug boolean?)
|
||||||
(s/def ::restic-repository string?)
|
(s/def ::execution-directory string?)
|
||||||
(s/def ::backup-path string?)
|
|
||||||
(s/def ::directory string?)
|
|
||||||
(s/def ::days-to-keep pos?)
|
|
||||||
(s/def ::months-to-keep pos?)
|
|
||||||
|
|
||||||
(s/def ::config
|
(s/def ::execution
|
||||||
(s/keys :req-un [::restic-repository ::backup-path ::days-to-keep ::months-to-keep]
|
(s/keys :req-un [::dry-run ::debug]
|
||||||
:opt-un [::certificate-file ::password-file ::directory]))
|
:opt-un [::execution-directory]))
|
||||||
|
|
||||||
(defn-spec repo-command ::command
|
|
||||||
[config ::config
|
|
||||||
command ::command]
|
|
||||||
(let [{:keys [certificate-file password-file directory restic-repository backup-path]} config]
|
|
||||||
(into
|
|
||||||
[]
|
|
||||||
(concat
|
|
||||||
(if (some? directory)
|
|
||||||
[{:dir directory}]
|
|
||||||
[])
|
|
||||||
["restic" "-r" (str restic-repository "/" backup-path) "-v"]
|
|
||||||
(cond
|
|
||||||
(some? certificate-file)
|
|
||||||
["--cacert" certificate-file]
|
|
||||||
(some? password-file)
|
|
||||||
["--password-file" password-file]
|
|
||||||
:else
|
|
||||||
[])
|
|
||||||
command))))
|
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
(ns dda.backup.management.domain
|
|
||||||
(:require
|
|
||||||
[orchestra.core :refer [defn-spec]]
|
|
||||||
[clojure.spec.alpha :as s]
|
|
||||||
[dda.backup.core.domain :as cd]))
|
|
||||||
|
|
||||||
(s/def ::config
|
|
||||||
(s/keys :req-un [::cd/restic-repository ::cd/backup-path ::cd/days-to-keep ::cd/months-to-keep]
|
|
||||||
:opt-un [::cd/certificate-file ::cd/password-file]))
|
|
||||||
|
|
||||||
(defn-spec check-repo-command ::cd/commands
|
|
||||||
[config ::config]
|
|
||||||
[(cd/repo-command config ["check"])])
|
|
||||||
|
|
||||||
(defn-spec init-repo-command ::cd/commands
|
|
||||||
[config ::config]
|
|
||||||
[(cd/repo-command config ["init"])])
|
|
||||||
|
|
||||||
(defn-spec unlock-repo-command ::cd/commands
|
|
||||||
[config ::config]
|
|
||||||
[(cd/repo-command config ["--cleanup-cache" "unlock"])])
|
|
||||||
|
|
||||||
(defn-spec list-snapshot-command ::cd/commands
|
|
||||||
[config ::config]
|
|
||||||
[(cd/repo-command config ["snapshots"])])
|
|
||||||
|
|
||||||
(defn-spec forget-command ::cd/commands
|
|
||||||
[config ::config]
|
|
||||||
(let [{:keys [days-to-keep months-to-keep]} config]
|
|
||||||
[(cd/repo-command config ["forget" "--group-by" ""
|
|
||||||
"--keep-last" "1"
|
|
||||||
"--keep-daily" (str days-to-keep)
|
|
||||||
"--keep-monthly" (str months-to-keep) "--prune"])]))
|
|
|
@ -1,21 +1,26 @@
|
||||||
(ns dda.backup.management
|
(ns dda.backup.restic
|
||||||
(:require
|
(:require
|
||||||
[orchestra.core :refer [defn-spec]]
|
[orchestra.core :refer [defn-spec]]
|
||||||
[clojure.spec.alpha :as s]
|
[clojure.spec.alpha :as s]
|
||||||
[dda.backup.core.domain :as cd]
|
[dda.backup.core.domain :as cd]
|
||||||
[dda.backup.management.domain :as domain]
|
[dda.backup.restic.domain :as domain]
|
||||||
[dda.backup.core :as core]
|
[dda.backup.core :as core]
|
||||||
[dda.backup.infrastructure :as i]))
|
[dda.backup.infrastructure :as i]))
|
||||||
|
|
||||||
|
(def default
|
||||||
|
(merge core/default
|
||||||
|
{:days-to-keep 30
|
||||||
|
:months-to-keep 12}))
|
||||||
|
|
||||||
(s/def ::config
|
(s/def ::config
|
||||||
(s/keys :req-un [::cd/restic-repository
|
(s/keys :req-un [::cd/restic-repository
|
||||||
::cd/backup-path]
|
::cd/backup-path]
|
||||||
:opt-un [::cd/certificate-file
|
:opt-un [::cd/certificate-file
|
||||||
::cd/password-file
|
::cd/password-file
|
||||||
::cd/days-to-keep
|
::cd/days-to-keep
|
||||||
::cd/months-to-keep
|
::cd/months-to-keep
|
||||||
::cd/directory
|
::cd/directory
|
||||||
::cd/dry-run
|
::cd/dry-run
|
||||||
::cd/debug]))
|
::cd/debug]))
|
||||||
|
|
||||||
(defn-spec initalized? boolean?
|
(defn-spec initalized? boolean?
|
||||||
|
@ -24,8 +29,7 @@
|
||||||
(try
|
(try
|
||||||
(i/execute! (domain/check-repo-command config-w-defaults) config-w-defaults)
|
(i/execute! (domain/check-repo-command config-w-defaults) config-w-defaults)
|
||||||
true
|
true
|
||||||
(catch Exception e false)
|
(catch Exception e false))))
|
||||||
)))
|
|
||||||
|
|
||||||
(defn-spec init! nil?
|
(defn-spec init! nil?
|
||||||
[config ::config]
|
[config ::config]
|
||||||
|
@ -41,4 +45,4 @@
|
||||||
(defn-spec forget! nil?
|
(defn-spec forget! nil?
|
||||||
[config ::config]
|
[config ::config]
|
||||||
(let [config-w-defaults (merge core/default config)]
|
(let [config-w-defaults (merge core/default config)]
|
||||||
(i/execute! (domain/forget-command config-w-defaults) config-w-defaults)))
|
(i/execute! (domain/forget-command config-w-defaults) config-w-defaults)))
|
65
src/dda/backup/restic/domain.clj
Normal file
65
src/dda/backup/restic/domain.clj
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
(ns dda.backup.restic.domain
|
||||||
|
(:require
|
||||||
|
[orchestra.core :refer [defn-spec]]
|
||||||
|
[clojure.spec.alpha :as s]
|
||||||
|
[dda.backup.core.domain :as cd]))
|
||||||
|
|
||||||
|
(s/def ::certificate-file string?)
|
||||||
|
(s/def ::password-file string?)
|
||||||
|
(s/def ::restic-repository string?)
|
||||||
|
(s/def ::backup-path string?)
|
||||||
|
(s/def ::days-to-keep pos?)
|
||||||
|
(s/def ::months-to-keep pos?)
|
||||||
|
|
||||||
|
(s/def ::config
|
||||||
|
(s/keys :req-un [::restic-repository
|
||||||
|
::backup-path
|
||||||
|
::days-to-keep
|
||||||
|
::months-to-keep]
|
||||||
|
:opt-un [::certificate-file
|
||||||
|
::password-file
|
||||||
|
::cd/execution-directory]))
|
||||||
|
|
||||||
|
(defn-spec repo-command ::cd/command
|
||||||
|
[config ::config
|
||||||
|
command ::cd/command]
|
||||||
|
(let [{:keys [certificate-file password-file execution-directory restic-repository backup-path]} config]
|
||||||
|
(into
|
||||||
|
[]
|
||||||
|
(concat
|
||||||
|
(if (some? execution-directory)
|
||||||
|
[{:dir execution-directory}]
|
||||||
|
[])
|
||||||
|
["restic" "-r" (str restic-repository "/" backup-path) "-v"]
|
||||||
|
(cond
|
||||||
|
(some? certificate-file)
|
||||||
|
["--cacert" certificate-file]
|
||||||
|
(some? password-file)
|
||||||
|
["--password-file" password-file]
|
||||||
|
:else
|
||||||
|
[])
|
||||||
|
command))))
|
||||||
|
|
||||||
|
(defn-spec check-repo-command ::cd/commands
|
||||||
|
[config ::config]
|
||||||
|
[(repo-command config ["check"])])
|
||||||
|
|
||||||
|
(defn-spec init-repo-command ::cd/commands
|
||||||
|
[config ::config]
|
||||||
|
[(repo-command config ["init"])])
|
||||||
|
|
||||||
|
(defn-spec unlock-repo-command ::cd/commands
|
||||||
|
[config ::config]
|
||||||
|
[(repo-command config ["--cleanup-cache" "unlock"])])
|
||||||
|
|
||||||
|
(defn-spec list-snapshot-command ::cd/commands
|
||||||
|
[config ::config]
|
||||||
|
[(repo-command config ["snapshots"])])
|
||||||
|
|
||||||
|
(defn-spec forget-command ::cd/commands
|
||||||
|
[config ::config]
|
||||||
|
(let [{:keys [days-to-keep months-to-keep]} config]
|
||||||
|
[(repo-command config ["forget" "--group-by" ""
|
||||||
|
"--keep-last" "1"
|
||||||
|
"--keep-daily" (str days-to-keep)
|
||||||
|
"--keep-monthly" (str months-to-keep) "--prune"])]))
|
|
@ -2,18 +2,19 @@
|
||||||
(:require
|
(:require
|
||||||
[orchestra.core :refer [defn-spec]]
|
[orchestra.core :refer [defn-spec]]
|
||||||
[clojure.spec.alpha :as s]
|
[clojure.spec.alpha :as s]
|
||||||
[dda.backup.core.domain :as cd]))
|
[dda.backup.core.domain :as cd]
|
||||||
|
[dda.backup.restic.domain :as rd]))
|
||||||
|
|
||||||
(s/def ::target-directory string?)
|
(s/def ::target-directory string?)
|
||||||
(s/def ::snapshot-id string?)
|
(s/def ::snapshot-id string?)
|
||||||
|
|
||||||
(s/def ::config
|
(s/def ::config
|
||||||
(s/keys :req-un [::target-directory ::snapshot-id
|
(s/merge ::rd/config
|
||||||
::cd/restic-repository ::cd/backup-path]
|
(s/keys :req-un [::target-directory
|
||||||
:opt-un [::cd/certificate-file ::cd/password-file ::cd/directory]))
|
::snapshot-id])))
|
||||||
|
|
||||||
(defn-spec restore-dir-command ::cd/commands
|
(defn-spec restore-dir-command ::cd/commands
|
||||||
[config ::config]
|
[config ::config]
|
||||||
(let [{:keys [target-directory snapshot-id]} config]
|
(let [{:keys [target-directory snapshot-id]} config]
|
||||||
[["rm" "-rf" target-directory]
|
[["rm" "-rf" target-directory]
|
||||||
(cd/repo-command config ["restore" snapshot-id "--target" target-directory])]))
|
(rd/repo-command config ["restore" snapshot-id "--target" target-directory])]))
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
"file2"]]
|
"file2"]]
|
||||||
(cut/backup-files-command {:restic-repository "repo"
|
(cut/backup-files-command {:restic-repository "repo"
|
||||||
:backup-path "dir-at-repo"
|
:backup-path "dir-at-repo"
|
||||||
:directory "dir-to-backup"
|
:execution-directory "dir-to-backup"
|
||||||
:days-to-keep 39
|
:days-to-keep 39
|
||||||
:months-to-keep 3
|
:months-to-keep 3
|
||||||
:files ["file2" "file2"]}))))
|
:files ["file2" "file2"]}))))
|
||||||
|
|
|
@ -2,11 +2,8 @@
|
||||||
(:require
|
(:require
|
||||||
[clojure.test :refer [deftest is are testing run-tests]]
|
[clojure.test :refer [deftest is are testing run-tests]]
|
||||||
[clojure.spec.alpha :as s]
|
[clojure.spec.alpha :as s]
|
||||||
[clojure.spec.test.alpha :as st]
|
|
||||||
[dda.backup.core.domain :as cut]))
|
[dda.backup.core.domain :as cut]))
|
||||||
|
|
||||||
(st/instrument `cut/repo-command)
|
|
||||||
|
|
||||||
(deftest should-verify-command
|
(deftest should-verify-command
|
||||||
(is (= {:app "restic", :params ["-r" "repo/dir" "-v" "init" "--cacert" "ca"]}
|
(is (= {:app "restic", :params ["-r" "repo/dir" "-v" "init" "--cacert" "ca"]}
|
||||||
(s/conform ::cut/command ["restic" "-r" "repo/dir" "-v" "init" "--cacert" "ca"]))))
|
(s/conform ::cut/command ["restic" "-r" "repo/dir" "-v" "init" "--cacert" "ca"]))))
|
||||||
|
@ -16,42 +13,3 @@
|
||||||
{:app "restic", :params ["-r" "repo/dir" "-v" "init" "--cacert" "ca"]}]
|
{:app "restic", :params ["-r" "repo/dir" "-v" "init" "--cacert" "ca"]}]
|
||||||
(s/conform ::cut/commands [["ls"]
|
(s/conform ::cut/commands [["ls"]
|
||||||
["restic" "-r" "repo/dir" "-v" "init" "--cacert" "ca"]]))))
|
["restic" "-r" "repo/dir" "-v" "init" "--cacert" "ca"]]))))
|
||||||
|
|
||||||
(deftest should-calculate-repo-command
|
|
||||||
(is (= [{:dir "dir"}
|
|
||||||
"restic"
|
|
||||||
"-r"
|
|
||||||
"repo/dir"
|
|
||||||
"-v"
|
|
||||||
"--cacert"
|
|
||||||
"ca"
|
|
||||||
"backup"
|
|
||||||
"file1"
|
|
||||||
"file2"]
|
|
||||||
(cut/repo-command {:certificate-file "ca"
|
|
||||||
:directory "dir"
|
|
||||||
:restic-repository "repo"
|
|
||||||
:backup-path "dir"
|
|
||||||
:days-to-keep 39
|
|
||||||
:months-to-keep 3}
|
|
||||||
["backup" "file1" "file2"])))
|
|
||||||
(is (= ["restic" "-r" "repo/dir" "-v" "--cacert" "ca" "snapshots"]
|
|
||||||
(cut/repo-command {:certificate-file "ca"
|
|
||||||
:restic-repository "repo"
|
|
||||||
:backup-path "dir"
|
|
||||||
:days-to-keep 39
|
|
||||||
:months-to-keep 3}
|
|
||||||
["snapshots"])))
|
|
||||||
(is (= ["restic" "-r" "repo/dir" "-v" "--password-file" "password" "snapshots"]
|
|
||||||
(cut/repo-command {:password-file "password"
|
|
||||||
:restic-repository "repo"
|
|
||||||
:backup-path "dir"
|
|
||||||
:days-to-keep 39
|
|
||||||
:months-to-keep 3}
|
|
||||||
["snapshots"])))
|
|
||||||
(is (= ["restic" "-r" "repo/dir" "-v" "snapshots"]
|
|
||||||
(cut/repo-command {:restic-repository "repo"
|
|
||||||
:backup-path "dir"
|
|
||||||
:days-to-keep 39
|
|
||||||
:months-to-keep 3}
|
|
||||||
["snapshots"]))))
|
|
|
@ -1,32 +0,0 @@
|
||||||
(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)
|
|
||||||
(st/instrument `cut/unlock-repo-command)
|
|
||||||
(st/instrument `cut/forget-command)
|
|
||||||
|
|
||||||
(deftest should-calculate-init-repo-command
|
|
||||||
(is (= [["restic" "-r" "repo/dir" "-v" "init"]]
|
|
||||||
(cut/init-repo-command {:restic-repository "repo"
|
|
||||||
:backup-path "dir"
|
|
||||||
:days-to-keep 39
|
|
||||||
:months-to-keep 3}))))
|
|
||||||
|
|
||||||
(deftest should-calculate-unlock-repo-command
|
|
||||||
(is (= [["restic" "-r" "repo/dir" "-v" "--cleanup-cache" "unlock"]]
|
|
||||||
(cut/unlock-repo-command {:restic-repository "repo"
|
|
||||||
: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}))))
|
|
72
test/dda/backup/restic/domain_test.clj
Normal file
72
test/dda/backup/restic/domain_test.clj
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
(ns dda.backup.restic.domain-test
|
||||||
|
(:require
|
||||||
|
[clojure.test :refer [deftest is are testing run-tests]]
|
||||||
|
[clojure.spec.test.alpha :as st]
|
||||||
|
[dda.backup.restic.domain :as cut]))
|
||||||
|
|
||||||
|
(st/instrument `cut/repo-command)
|
||||||
|
(st/instrument `cut/init-repo-command)
|
||||||
|
(st/instrument `cut/unlock-repo-command)
|
||||||
|
(st/instrument `cut/forget-command)
|
||||||
|
|
||||||
|
(deftest should-calculate-repo-command
|
||||||
|
(is (= [{:dir "dir"}
|
||||||
|
"restic"
|
||||||
|
"-r"
|
||||||
|
"repo/dir"
|
||||||
|
"-v"
|
||||||
|
"--cacert"
|
||||||
|
"ca"
|
||||||
|
"backup"
|
||||||
|
"file1"
|
||||||
|
"file2"]
|
||||||
|
(cut/repo-command {:certificate-file "ca"
|
||||||
|
:execution-directory "dir"
|
||||||
|
:restic-repository "repo"
|
||||||
|
:backup-path "dir"
|
||||||
|
:days-to-keep 39
|
||||||
|
:months-to-keep 3}
|
||||||
|
["backup" "file1" "file2"])))
|
||||||
|
(is (= ["restic" "-r" "repo/dir" "-v" "--cacert" "ca" "snapshots"]
|
||||||
|
(cut/repo-command {:certificate-file "ca"
|
||||||
|
:restic-repository "repo"
|
||||||
|
:backup-path "dir"
|
||||||
|
:days-to-keep 39
|
||||||
|
:months-to-keep 3}
|
||||||
|
["snapshots"])))
|
||||||
|
(is (= ["restic" "-r" "repo/dir" "-v" "--password-file" "password" "snapshots"]
|
||||||
|
(cut/repo-command {:password-file "password"
|
||||||
|
:restic-repository "repo"
|
||||||
|
:backup-path "dir"
|
||||||
|
:days-to-keep 39
|
||||||
|
:months-to-keep 3}
|
||||||
|
["snapshots"])))
|
||||||
|
(is (= ["restic" "-r" "repo/dir" "-v" "snapshots"]
|
||||||
|
(cut/repo-command {:restic-repository "repo"
|
||||||
|
:backup-path "dir"
|
||||||
|
:days-to-keep 39
|
||||||
|
:months-to-keep 3}
|
||||||
|
["snapshots"]))))
|
||||||
|
|
||||||
|
(deftest should-calculate-init-repo-command
|
||||||
|
(is (= [["restic" "-r" "repo/dir" "-v" "init"]]
|
||||||
|
(cut/init-repo-command {:restic-repository "repo"
|
||||||
|
:backup-path "dir"
|
||||||
|
:days-to-keep 39
|
||||||
|
:months-to-keep 3}))))
|
||||||
|
|
||||||
|
(deftest should-calculate-unlock-repo-command
|
||||||
|
(is (= [["restic" "-r" "repo/dir" "-v" "--cleanup-cache" "unlock"]]
|
||||||
|
(cut/unlock-repo-command {:restic-repository "repo"
|
||||||
|
: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}))))
|
Loading…
Reference in a new issue