backupninja/test/sh.bats

18 lines
479 B
Plaintext
Raw Normal View History

2018-07-13 16:40:36 +02:00
load common
setup_sh() {
2018-07-13 16:40:36 +02:00
cat << EOF > "${BATS_TMPDIR}/backup.d/test.sh"
!#/bin/sh
touch /var/backups/test_sh
EOF
chmod 0750 "${BATS_TMPDIR}/backup.d/test.sh"
}
@test "sh: runs and creates file" {
run backupninja -f "${BATS_TMPDIR}/backupninja.conf" --now --run "${BATS_TMPDIR}/backup.d/test.sh"
[ "$status" -eq 0 ]
[ -f /var/backups/test_sh ]
grep -q "Info: FINISHED: 1 actions run. 0 fatal. 0 error. 0 warning." "${BATS_TMPDIR}/log/backupninja.log"
}