Skip to content

Commit

Permalink
add tests for ownership
Browse files Browse the repository at this point in the history
  • Loading branch information
Tieske committed Mar 3, 2022
1 parent 693310d commit 4764092
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions tests/05-ownership.test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env bash

function run_test {
# the suite name below will only be used when running this file directly, when
# running through "test.sh" it must be provided using the "--suite" option.
tinitialize "Docker-Kong test suite" "${BASH_SOURCE[0]}"

tchapter "ownership is root:kong"


for filename in \
/usr/local/share/lua/5.1/ \
/usr/local/share/lua/5.1/kong/plugins/ \
/usr/local/lib/lua/5.1/ \
/usr/local/lib/luarocks/rocks-5.1/
do
ttest "owenership $filename"
local USR
local GRP
USR=$(docker run -ti --rm "kong-$BASE" ls -ld $filename | awk '{print $3}')
GRP=$(docker run -ti --rm "kong-$BASE" ls -ld $filename | awk '{print $4}')
if [ "$USR:$GRP" == "root:kong" ]; then
tsuccess
else
tmessage "user and group set to $USR:$GRP"
tfailure
fi
done

tfinish
}

# No need to modify anything below this comment

# shellcheck disable=SC1090 # do not follow source
[[ "$T_PROJECT_NAME" == "" ]] && set -e && if [[ -f "${1:-$(dirname "$(realpath "$0")")/test.sh}" ]]; then source "${1:-$(dirname "$(realpath "$0")")/test.sh}"; else source "${1:-$(dirname "$(realpath "$0")")/run.sh}"; fi && set +e
run_test

0 comments on commit 4764092

Please sign in to comment.