From e563a9d43d9062891f63797c8464f90747103fd9 Mon Sep 17 00:00:00 2001 From: Abdulrhmn Ghanem Date: Fri, 14 Oct 2022 07:43:31 +0200 Subject: [PATCH] processor: run tests as root in the container - 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. --- processor/Dockerfile | 1 - scripts/clear_volumes_and_test_processor.sh | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/processor/Dockerfile b/processor/Dockerfile index 6a00397b3b..e5921007e8 100644 --- a/processor/Dockerfile +++ b/processor/Dockerfile @@ -36,4 +36,3 @@ RUN addgroup --gid 1000 node && \ USER node CMD ["node", "dist/src/server.js"] - diff --git a/scripts/clear_volumes_and_test_processor.sh b/scripts/clear_volumes_and_test_processor.sh index 51e70fc9fc..d7e9e8b718 100755 --- a/scripts/clear_volumes_and_test_processor.sh +++ b/scripts/clear_volumes_and_test_processor.sh @@ -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 permessions to do anything 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}"