diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2022-07-12 13:29:16 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2022-07-12 13:42:09 +0200 |
commit | d475036b10cfb4690d59c4108403bc521003a327 (patch) | |
tree | d54968ec64cdf7d1d04f8b898204ae8bb728dada /tests | |
parent | c3001d97bcac3b023b3f9948c1b8e3a1cb52f6a8 (diff) | |
download | alpine-conf-d475036b10cfb4690d59c4108403bc521003a327.zip |
tests: lbu package pre/post hooks
add test to verify that pre/post package hooks are executed.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/lbu_test | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/tests/lbu_test b/tests/lbu_test index ddbfef2..73f0e65 100755 --- a/tests/lbu_test +++ b/tests/lbu_test @@ -25,6 +25,7 @@ init_tests \ lbu_st_usage \ lbu_package \ lbu_package_encrypted \ + lbu_package_pre_post_hooks lbu_usage_body() { test_usage lbu @@ -185,13 +186,18 @@ lbu_package_body() { tar -ztf $(hostname).apkovl.tar.gz } -lbu_package_encrypted_body() { - atf_require_prog openssl - init_env - sysconfdir=$(grep "^sysconfdir=" $(atf_get_srcdir)/../lbu | cut -d= -f2-) +get_sysconfdir() { + sysconfdir=$(grep "^sysconfdir=" $(atf_get_srcdir)/../lbu \ + | cut -d= -f2-) if [ -z "$sysconfdir" ]; then atf_fail "sysconfdir is not set" fi +} + +lbu_package_encrypted_body() { + atf_require_prog openssl + init_env + get_sysconfdir mkdir -p "$PWD"/"$sysconfdir" ( echo 'DEFAULT_CIPHER=aes-256-cbc' @@ -208,3 +214,24 @@ lbu_package_encrypted_body() { atf_fail "ecrypted archive not created" fi } + +lbu_package_pre_post_hooks_body() { + init_env + get_sysconfdir + create_fake_apk_audit + + mkdir -p "$PWD/$sysconfdir/pre-package.d" \ + "$PWD/$sysconfdir/post-package.d" + cat >"$PWD/$sysconfdir/pre-package.d/foo.sh"<<-EOF + #!/bin/sh + echo \$0 + EOF + chmod +x "$PWD/$sysconfdir/pre-package.d/foo.sh" + ln -s ../pre-package.d/foo.sh \ + "$PWD/$sysconfdir/post-package.d/foo.sh" + + atf_check \ + -e match:"pre-package" \ + -e match:"post-package" \ + lbu package +} |