test: bkctld check-incs shouldn't fail without incs_policy file

Currently it does, because we "stat" a blank file (issue #43).
This commit is contained in:
Jérémy Lecour 2021-02-08 14:16:03 +01:00 committed by Jérémy Lecour
parent b7cddcac27
commit a41eb2a218
2 changed files with 16 additions and 0 deletions

View File

@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
* test: bkctld check-incs shouldn't fail without incs_policy file
### Changed
### Deprecated

View File

@ -235,4 +235,18 @@ OUT
run /usr/lib/bkctld/bkctld-check-incs
assert_equal "0" "$status"
}
@test "Check-incs doesn't fail without incs_policy file" {
# Delete all possible incs polixy files
rm -f /etc/evobackup/${JAILNAME}
rm -rf /etc/evobackup/${JAILNAME}.d/incs_policy
# Run bkctld-check-incs and store stderr in a file
local stderrPath="${BATS_TMPDIR}/${BATS_TEST_NAME}.stderr"
/usr/lib/bkctld/bkctld-check-incs 2> ${stderrPath}
# Verify if
run grep -E "^stat:" ${stderrPath}
assert_failure
}
# TODO: write many more tests for bkctld-check-incs