Skip to content

Commit

Permalink
Cirrus CI: Run unit tests as a non-privileged user.
Browse files Browse the repository at this point in the history
Tests involving file access control fail systematically if the test suite is
run as root (which happens in Cirrus CI's Docker containers).  Since the
official Python containers are built on top of Debian, we might be able to run
using the UNIX standard user `bin` without creating an ad-hoc test user.
  • Loading branch information
riccardomurri committed Aug 7, 2021
1 parent 6632a3b commit 5a721a9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,14 @@ task:
# for testing. The `python` official Docker image is built on top of
# Debian, so use `apt` to install it.
apt-get update
apt-get install -y time
apt-get install -y sudo time
install_script: |
pip install -e '.[daemon,ec2,openstack,optimizer]'
test_script: |
set -e
pip install 'pytest>=4.1' 'pytest-cov' 'pytest-coverage' 'mock' 'tox' 'codecov'
pytest -v --cov=gc3libs --cov-branch --ignore install.py
# run tests as a non-privileged user, otherwise access control tests fail
sudo -u bin pytest -v --cov=gc3libs --cov-branch --ignore install.py
codecov
echo "OK: GC3Pie's unit tests successfully performed."
exit 0
Expand Down

0 comments on commit 5a721a9

Please sign in to comment.