From eec066321c16210b3ebc4aebb9640d8148626b85 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 | 6 ++++-- 2 files changed, 4 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..86791ae494 100755 --- a/scripts/clear_volumes_and_test_processor.sh +++ b/scripts/clear_volumes_and_test_processor.sh @@ -21,7 +21,9 @@ docker-compose down -v # you can pass arguments to mocha e.g. `-g multi` args="$(concatenate_args "$@")" docker-compose run \ - -u node \ + # 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. + -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}"