]> gitweb.hhaalo.de Git - simple-backup.git/commitdiff
add info for excludes
authorBastian Dehn <hhaalo@arcor.de>
Wed, 5 Aug 2026 19:12:54 +0000 (21:12 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Wed, 5 Aug 2026 19:12:54 +0000 (21:12 +0200)
src/backup
tests/backup_tests.bats

index aa53b92ec9498325e0598600f0d769b8fe61923a..073e9d7c66ff9036733b4445af11579d16f9616e 100755 (executable)
@@ -152,6 +152,10 @@ path_backup()
        [ "$port" != "null" ] \
                || errlog "missing port for $machine" \
                || return $?
+       local excludes=()
+       mapfile -t excludes < <(echo "$config" \
+               | jq --raw-output ".machines.$machine.excludes[]")
+       echo "ℹ️ INFO: machine $machine; excludes ${excludes[*]}"
        # TODO: config read - rsync implementation
 }
 
index af9d21eb34604d005353be6e2d59b7c68d46eaa6..8110144cf5459e4c8993356b630ecba43d6e2c2b 100755 (executable)
@@ -288,6 +288,9 @@ teardown() {
 }
 
 @test "success backup machine pathes" {
+       path_backup() {
+               :
+       }
        run main
 
        assert_success
@@ -424,4 +427,21 @@ teardown() {
        assert_line --index 7 "################################################################################"
        assert_line --index 8 "ℹ️ INFO: machine ${LIGHTPURPLE}testpc1${RESET}; path ${YELLOW}/home/user${RESET}"
        assert_line --index 9 "❌ ERROR: missing port for testpc1"
+}
+
+@test "success backup machine path excludes info" {
+       run main
+
+       assert_success
+       assert_line --index 0 "⭐ START: backup"
+       assert_line --index 1 "ℹ️ INFO: backup path build"
+       assert_line --index 2 "ℹ️ INFO: backup name backup"
+       assert_line --index 3 "ℹ️ INFO: backup count 15"
+       assert_line --index 4 "ℹ️ INFO: backup folder 2000-01-01_01_backup"
+       assert_line --index 5 "ℹ️ INFO: create folder build/2000-01-01_01_backup"
+       assert_line --index 6 "ℹ️ INFO: create directory build/2000-01-01_01_backup/testpc1"
+       assert_line --index 7 "################################################################################"
+       assert_line --index 8 "ℹ️ INFO: machine ${LIGHTPURPLE}testpc1${RESET}; path ${YELLOW}/etc${RESET}"
+       assert_line --index 9 "ℹ️ INFO: machine ${LIGHTPURPLE}testpc1${RESET}; excludes /home/user/.cache /home/user/.local"
+       assert_line --index 10 "################################################################################"
 }
\ No newline at end of file