From 1532c733c90fbfbce32f75ed142926af28cc670b Mon Sep 17 00:00:00 2001
From: Dominik George <nik@naturalnet.de>
Date: Thu, 5 Dec 2019 17:33:20 +0100
Subject: [PATCH] Use unprivileged user to run tests in CI.

---
 .gitlab-ci.yml | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c8c4292f4..a96c4deeb 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -11,11 +11,12 @@ test:
   image:
     name: python:3.8-buster
   before_script:
-    - apt-get -y update && apt-get -y install postgresql libpq5 libpq-dev libssl-dev
+    - apt-get -y update && apt-get -y install postgresql libpq5 libpq-dev libssl-dev sudo
     - pip install poetry
+    - adduser --group --disabled-password --gecos "Test User" testuser
   script:
-    - poetry install
-    - poetry run tox
+    - sudo -u testuser poetry install
+    - sudo -u testuser poetry run tox
 
 build_docker:
   stage: build
-- 
GitLab