]> gitweb.hhaalo.de Git - simple-backup.git/commitdiff
add ssh command check
authorBastian Dehn <hhaalo@arcor.de>
Mon, 3 Aug 2026 15:51:37 +0000 (17:51 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Mon, 3 Aug 2026 15:51:37 +0000 (17:51 +0200)
src/backup
tests/backup_tests.bats

index ca33079a2fba7a193dec903d2498426ac0892fba..09b17e29adab2e14fc6bacae94bf00290db00a59 100755 (executable)
@@ -22,6 +22,9 @@ main()
        command -v rsync > /dev/null \
                || errlog "command rsync not found" \
                || return $?
+       command -v ssh > /dev/null \
+               || errlog "command ssh not found" \
+               || return $?
 }
 
 [ "$TESTMODE" == "ON" ] || return 0
index a2bdccbac26b5c676da8f8f6b1d45f5673d0fdfd..6bc87162c39ebb2ee16679c18e30c199a666b1cf 100755 (executable)
@@ -59,3 +59,15 @@ teardown() {
        assert_line --index 0 "⭐ START: backup"
        assert_line --index 1 "❌ ERROR: command rsync not found"
 }
+
+@test "failure ssh command not found" {
+       command() {
+               [ "$2" != "ssh" ] || return 1
+       }
+
+       run main
+
+       assert_failure
+       assert_line --index 0 "⭐ START: backup"
+       assert_line --index 1 "❌ ERROR: command ssh not found"
+}