From 9d857d3a9e09031c41605860f00ede5425871798 Mon Sep 17 00:00:00 2001 From: Tim Ramlot <42113979+inteon@users.noreply.github.com> Date: Wed, 23 Aug 2023 22:35:53 +0200 Subject: [PATCH] add e2e tests for the posix feature Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com> --- integration_test.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/integration_test.sh b/integration_test.sh index 46b4c15611..ea151ad372 100755 --- a/integration_test.sh +++ b/integration_test.sh @@ -92,6 +92,7 @@ fi echo "7. On outside the module should fail." pushd .. || exit 1 GO111MODULE=on ./ko/ko build --local github.com/go-training/helloworld && exit 1 +echo "Test PASSED" popd || exit 1 echo "8. On outside with build config specifying the test module builds." @@ -110,6 +111,18 @@ for app in foo bar ; do done popd || exit 1 +echo "9. Auto inside the module without vendoring & run with requesteed capabilities should output TEST" +RESULT="$(GO111MODULE=auto GOFLAGS="" ./ko build --posix-capabilities CAP_IPC_LOCK --local github.com/go-training/helloworld | grep "$FILTER" | xargs -I% docker run --cap-add CAP_IPC_LOCK %)" +if [[ "$RESULT" != *"TEST"* ]]; then + echo "Test FAILED. Saw $RESULT" && exit 1 +else + echo "Test PASSED" +fi + +echo "10. Auto inside the module without vendoring & run with too little capabilities should fail" +(GO111MODULE=auto GOFLAGS="" ./ko build --posix-capabilities CAP_CHOWN --local github.com/go-training/helloworld | grep "$FILTER" | xargs -I% docker run --cap-drop CAP_CHOWN %) && exit 1 +echo "Test PASSED" + popd || exit 1 popd || exit 1