Skip to content

Commit 20cca86

Browse files
committedSep 21, 2018
makes tests run with a normal user instead of root
1 parent e22ecb0 commit 20cca86

File tree

5 files changed

+26
-11
lines changed

5 files changed

+26
-11
lines changed
 

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
/.venv
33
/tmp
44
/wiki
5+
/builds
56

67
# setuptools build files
78
/dist

‎data/docker/Dockerfile.archlinux

+7-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,13 @@ RUN pacman -S --noconfirm \
1414
RUN pacman -S --noconfirm \
1515
python-dbus python-paramiko python-ruamel-yaml
1616

17-
COPY tests/.ssh /root/.ssh
18-
RUN chmod -R 700 /root/.ssh
17+
# add a normal user used for testing
18+
RUN useradd --create-home dups
19+
20+
# prepare ssh environment
21+
COPY tests/.ssh /home/dups/.ssh
22+
RUN chown -R dups:dups /home/dups/.ssh
23+
RUN chmod -R 700 /home/dups/.ssh
1924

2025
RUN mkdir /var/run/sshd
2126
RUN /usr/bin/ssh-keygen -A

‎data/docker/Dockerfile.bionic

+7-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,13 @@ RUN apt-get install --no-install-recommends -y \
1818
RUN apt-get install --no-install-recommends -y \
1919
python3-dbus python3-paramiko python3-ruamel.yaml
2020

21-
COPY tests/.ssh /root/.ssh
22-
RUN chmod -R 700 /root/.ssh
21+
# add a normal user used for testing
22+
RUN useradd --create-home dups
23+
24+
# prepare ssh environment
25+
COPY tests/.ssh /home/dups/.ssh
26+
RUN chown -R dups:dups /home/dups/.ssh
27+
RUN chmod -R 700 /home/dups/.ssh
2328

2429
RUN mkdir /var/run/sshd
2530
RUN /usr/bin/ssh-keygen -A

‎data/docker/Dockerfile.stretch

+7-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,13 @@ RUN apt-get install --no-install-recommends -y \
1818
RUN apt-get install --no-install-recommends -y \
1919
python3-dbus python3-paramiko python3-ruamel.yaml
2020

21-
COPY tests/.ssh /root/.ssh
22-
RUN chmod -R 700 /root/.ssh
21+
# add a normal user used for testing
22+
RUN useradd --create-home dups
23+
24+
# prepare ssh environment
25+
COPY tests/.ssh /home/dups/.ssh
26+
RUN chown -R dups:dups /home/dups/.ssh
27+
RUN chmod -R 700 /home/dups/.ssh
2328

2429
RUN mkdir /var/run/sshd
2530
RUN /usr/bin/ssh-keygen -A

‎data/scripts/travis/test-dups.sh

+4-5
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@ fi
77

88
PYTHON="$1"
99

10-
cp -r /dups /tmp/dups
11-
cd /tmp/dups
12-
10+
cp -r /dups /home/dups/source
11+
chown -R dups:dups /home/dups/source
1312

1413
# SSH server is required for remote tests
1514
/usr/sbin/sshd
1615

1716
# Run all unittests
18-
${PYTHON} -m unittest discover -v -s tests
19-
17+
cd /home/dups/source
18+
su dups -c "${PYTHON} -m unittest discover -v -s tests"

0 commit comments

Comments
 (0)
Please sign in to comment.