From a41eb2a21819c681dd7d8a093081a25e75b46e21 Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Mon, 8 Feb 2021 14:16:03 +0100 Subject: [PATCH] test: bkctld check-incs shouldn't fail without incs_policy file Currently it does, because we "stat" a blank file (issue #43). --- CHANGELOG.md | 2 ++ test/checks.bats | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a1a622b..0c7d87b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/test/checks.bats b/test/checks.bats index f8e5c85..65a2ccc 100644 --- a/test/checks.bats +++ b/test/checks.bats @@ -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