Skip to content

Commit

Permalink
processor: run tests as root in the container
Browse files Browse the repository at this point in the history
- We need to install packages, compile ts, and move assets before running
the actual testing code.
- The `node` user doesn't have permessions to do anything of these
  tasks.

Update scripts/clear_volumes_and_test_processor.sh

Co-authored-by: Kaspar Emanuel <[email protected]>
  • Loading branch information
AbdulrhmnGhanem and kasbah committed Oct 27, 2022
1 parent a149c1f commit 84d03ee
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions docker-compose.override.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ services:
dockerfile: Dockerfile

processor:
user: root
build:
context: processor/
dockerfile: Dockerfile
Expand Down
1 change: 0 additions & 1 deletion processor/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,3 @@ RUN addgroup --gid 1000 node && \

USER node
CMD ["node", "dist/src/server.js"]

7 changes: 5 additions & 2 deletions scripts/clear_volumes_and_test_processor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ docker-compose down -v

# you can pass arguments to mocha e.g. `-g multi`
args="$(concatenate_args "$@")"

# We need to install packages, compile ts, and move assets before running the actual testing code.
# The `node` user doesn't have permission to do any of these tasks.
docker-compose run \
-u node \
-u root \
-e LOG_LEVEL=debug \
-e DATA_DIR=/data/test \
processor sh -c "whoami && stat /data /gitea-data /app"
processor sh -c "yarn install && yarn tsc && yarn cp-assets && yarn cp-test-assets && yarn test ${args}"

0 comments on commit 84d03ee

Please sign in to comment.