2018-07-13 16:40:36 +02:00
|
|
|
load common
|
|
|
|
|
2018-07-15 06:50:15 +02:00
|
|
|
setup_sh() {
|
2018-07-13 16:40:36 +02:00
|
|
|
cat << EOF > "${BATS_TMPDIR}/backup.d/test.sh"
|
|
|
|
!#/bin/sh
|
2021-01-04 04:36:49 +01:00
|
|
|
when = manual
|
|
|
|
touch "${BN_BACKUPDIR}/testsh"
|
2018-07-13 16:40:36 +02:00
|
|
|
EOF
|
|
|
|
|
|
|
|
chmod 0750 "${BATS_TMPDIR}/backup.d/test.sh"
|
|
|
|
}
|
|
|
|
|
2021-01-04 04:36:49 +01:00
|
|
|
teardown_sh() {
|
|
|
|
cleanup_backups local
|
|
|
|
}
|
|
|
|
|
2021-01-07 04:22:43 +01:00
|
|
|
@test "runs and creates file" {
|
|
|
|
runaction
|
2021-01-04 04:36:49 +01:00
|
|
|
[ -f "${BN_BACKUPDIR}/testsh" ]
|
|
|
|
greplog "Info: FINISHED: 1 actions run. 0 fatal. 0 error. 0 warning."
|
|
|
|
}
|
|
|
|
|
2021-01-07 04:22:43 +01:00
|
|
|
@test "is not executed in test mode" {
|
|
|
|
testaction
|
2021-01-04 04:36:49 +01:00
|
|
|
[ ! -f "${BN_BACKUPDIR}/testsh" ]
|
|
|
|
greplog "Info: FINISHED: 1 actions run. 0 fatal. 0 error. 0 warning."
|
2018-07-13 16:40:36 +02:00
|
|
|
}
|