summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2022-06-28 17:54:22 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2022-06-28 18:23:25 +0200
commitc55971dbb9021934816d96383450210235890a23 (patch)
tree5372c94284e7d81605e8f6a6d1e6f5710fc93b92
parent6d7bf96c89bdcd9fe5bb30504e4817345f44ffac (diff)
downloadalpine-conf-c55971dbb9021934816d96383450210235890a23.zip
lbu: add test for add/delete
-rw-r--r--lbu.in2
-rwxr-xr-xtests/lbu_test22
2 files changed, 23 insertions, 1 deletions
diff --git a/lbu.in b/lbu.in
index 224f06b..ae4220c 100644
--- a/lbu.in
+++ b/lbu.in
@@ -17,7 +17,7 @@ fi
EXCLUDE_LIST="$sysconfdir"/exclude
INCLUDE_LIST="$sysconfdir"/include
-LBU_LIST="/etc/apk/protected_paths.d/lbu.list"
+LBU_LIST="${ROOT}etc/apk/protected_paths.d/lbu.list"
DEFAULT_CIPHER="aes-256-cbc"
diff --git a/tests/lbu_test b/tests/lbu_test
index 3c23bcf..6cd47b2 100755
--- a/tests/lbu_test
+++ b/tests/lbu_test
@@ -6,6 +6,7 @@ init_tests \
lbu_include_usage \
lbu_inc_usage \
lbu_add_usage \
+ lbu_add_delete \
lbu_commit_usage \
lbu_ci_usage \
lbu_exclude_usage \
@@ -35,6 +36,27 @@ lbu_add_usage_body() {
lbu add -h
}
+lbu_add_delete_body() {
+ init_env
+ mkdir -p root/.ssh
+ atf_check -s exit:0 \
+ -o match:"Adding root/.ssh to" \
+ -e empty \
+ lbu add -v root/.ssh
+
+ atf_check -s exit:0 \
+ -o match:"root/.ssh" \
+ cat etc/apk/protected_paths.d/lbu.list
+
+ atf_check -s exit:0 \
+ -o match:"Removing root/.ssh from" \
+ -e empty \
+ lbu delete -v root/.ssh
+
+ grep 'root/.ssh' etc/apk/protected_paths.d/lbu.list \
+ || atf_fail "root/.ssh was not removed"
+}
+
lbu_commit_usage_body() {
test_usage "lbu commit"
}