Skip to content

Commit

Permalink
s3-config-validator specs use non-root user
Browse files Browse the repository at this point in the history
This fixes an issue in CI where `root` has no restrictions on file
access resulting in tests which expect to verify when files are _not_
accessible.
  • Loading branch information
aramprice committed Sep 11, 2024
1 parent 8532a3a commit e7f14d6
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions s3-config-validator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,22 @@ artifact: build
build:
./build_all.sh

ifeq ($(shell whoami), root)
NON_ROOT_USER='bbr'
test-unit:
cd src/ && \
go run github.com/onsi/ginkgo/v2/ginkgo -r --keep-going internal
cd src/ \
&& chmod -R g+w . \
&& useradd --groups root --create-home $(NON_ROOT_USER) \
&& set +x; \
su $(NON_ROOT_USER) -c 'go run github.com/onsi/ginkgo/v2/ginkgo -r --keep-going internal'; \
status=$$?; \
userdel --remove bbr \
&& exit $${status}
else
test-unit:
cd src/ \
&& go run github.com/onsi/ginkgo/v2/ginkgo -r --keep-going internal
endif

test-e2e:
cd src/test && \
Expand Down

0 comments on commit e7f14d6

Please sign in to comment.