integration test now works

This commit is contained in:
Michael Jerger 2024-08-16 19:13:58 +02:00
parent 848b03c6ce
commit c0a5539d19
2 changed files with 9 additions and 6 deletions

View file

@ -18,8 +18,8 @@ function main() {
rm -rf /var/backups/gitea/* rm -rf /var/backups/gitea/*
rm -rf /var/backups/git/repositories/* rm -rf /var/backups/git/repositories/*
cp -r /var/backups/restore/gitea /var/backups/ #ToDo: mv instead of cp or rm -rf after mv /var/backups/restore/gitea /var/backups/
cp -r /var/backups/restore/git/repositories /var/backups/git/ #ToDo: mv instead of cp or rm -rf after mv /var/backups/restore/git/repositories /var/backups/git/
# adjust file permissions for the git user # adjust file permissions for the git user
chown -R 1000:1000 /var/backups chown -R 1000:1000 /var/backups

View file

@ -2,7 +2,8 @@
(require '[babashka.tasks :as tasks] (require '[babashka.tasks :as tasks]
'[dda.backup.management :as mgm] '[dda.backup.management :as mgm]
'[dda.backup.backup :as bak]) '[dda.backup.backup :as bak]
'[dda.backup.restore :as rs])
(defn restic-repo-init! (defn restic-repo-init!
[] []
@ -15,13 +16,15 @@
(tasks/shell "mkdir" "-p" "test-backup") (tasks/shell "mkdir" "-p" "test-backup")
(spit "test-backup/file" "I was here") (spit "test-backup/file" "I was here")
(bak/backup! {:password-file "restic-pwd" (bak/backup! {:password-file "restic-pwd"
:restic-repository "restic-repo"} :restic-repository "restic-repo"
["test-backup"])) :files ["test-backup"]}))
(defn restic-restore! (defn restic-restore!
[] []
(tasks/shell "mkdir" "-p" "test-restore") (tasks/shell "mkdir" "-p" "test-restore")
(tasks/shell "restic" "restore" "--password-file" "restic-pwd" "--repo" "restic-repo" "--target" "test-restore" "latest")) (rs/restore! {:password-file "restic-pwd"
:restic-repository "restic-repo"
:target-directory "test-restore"}))
(restic-repo-init!) (restic-repo-init!)
(restic-backup!) (restic-backup!)