Skip to content

Commit

Permalink
tests: Shift pip install to run_jenkins_tests
Browse files Browse the repository at this point in the history
Otherwise it's run as root rather than whatever user is being used
inside the container.
  • Loading branch information
jrtc27 committed May 21, 2024
1 parent fd9cbc4 commit 5d57c39
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 15 deletions.
4 changes: 1 addition & 3 deletions tests/python-baseline.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
FROM python:3.8.0
LABEL maintainer="[email protected]"

COPY requirements.txt /tmp/requirements.txt
RUN pip install -r /tmp/requirements.txt && rm -f /tmp/requirements.txt
LABEL maintainer="[email protected]"

# setting Git username and email for workaround of
# https://github.com/jenkinsci/docker/issues/519
Expand Down
3 changes: 0 additions & 3 deletions tests/python-latest.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ FROM python:latest

LABEL maintainer="[email protected]"

COPY requirements.txt /tmp/requirements.txt
RUN pip install -r /tmp/requirements.txt && rm -f /tmp/requirements.txt

# setting Git username and email for workaround of
# https://github.com/jenkinsci/docker/issues/519
ENV GIT_COMMITTER_NAME cheribuild
Expand Down
10 changes: 7 additions & 3 deletions tests/run_jenkins_tests.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#!/usr/bin/env bash

pytest_binary="python3 -m pytest"


case $1 in
baseline|latest|ubuntu-baseline|ubuntu-latest)
test_prefix=$1
Expand Down Expand Up @@ -30,6 +27,13 @@ else
cd "$_srcdir"
fi

if ! python3 -m pip install --user -r requirements.txt; then
echo "FATAL: could not install requirements"
exit 1
fi

pytest_binary="python3 -m pytest"

# Run unit tests
rm -f "../$test_prefix-results.xml"
$pytest_binary -v --junit-xml "../$test_prefix-results.xml" tests || echo "Some tests failed"
Expand Down
3 changes: 0 additions & 3 deletions tests/ubuntu-baseline.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,3 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
git \
python3-minimal python3-pip python3-setuptools

COPY requirements.txt /tmp/requirements.txt
RUN pip3 install --user -r /tmp/requirements.txt && rm -f /tmp/requirements.txt
3 changes: 0 additions & 3 deletions tests/ubuntu-latest.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,3 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
git \
python3-minimal python3-pip python3-setuptools

COPY requirements.txt /tmp/requirements.txt
RUN pip3 install --user -r /tmp/requirements.txt && rm -f /tmp/requirements.txt

0 comments on commit 5d57c39

Please sign in to comment.