Skip to content

Commit

Permalink
Merge pull request pi-hole#1210 from lightswitch05/feature/cleanup-te…
Browse files Browse the repository at this point in the history
…sts-and-test-dependencies

Remove old test dependencies, updated ones still being used. Introduce Black formatter
  • Loading branch information
PromoFaux authored Sep 18, 2022
2 parents 2164220 + 4da6631 commit a9ecd4e
Show file tree
Hide file tree
Showing 9 changed files with 454 additions and 852 deletions.
6 changes: 3 additions & 3 deletions test/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.8-slim-bullseye
FROM python:3.10-slim-bullseye

# Only works for docker CLIENT (bind mounted socket)
COPY --from=docker:20.10.17 /usr/local/bin/docker /usr/local/bin/
Expand All @@ -10,15 +10,15 @@ RUN apt-get update && \
&& rm -rf /var/lib/apt/lists/* \
&& pip3 install --no-cache-dir -U pip pipenv

RUN curl -L https://github.com/docker/compose/releases/download/1.25.5/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose && \
RUN curl -L https://github.com/docker/compose/releases/download/2.10.2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose && \
chmod +x /usr/local/bin/docker-compose

COPY ./cmd.sh /usr/local/bin/
COPY Pipfile* /root/
WORKDIR /root

RUN pipenv install --system \
&& sed -i 's|/bin/sh|/bin/bash|g' /usr/local/lib/python3.8/site-packages/testinfra/backend/docker.py
&& sed -i 's|/bin/sh|/bin/bash|g' /usr/local/lib/python3.10/site-packages/testinfra/backend/docker.py

RUN echo "set -ex && cmd.sh && \$@" > /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
Expand Down
59 changes: 5 additions & 54 deletions test/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,59 +6,10 @@ verify_ssl = true
[dev-packages]

[packages]
apipkg = "==1.5"
atomicwrites = "==1.4.1"
attrs = "==19.3.0"
bcrypt = "==3.1.7"
cached-property = "==1.5.1"
certifi = "==2019.11.28"
cffi = "==1.13.2"
chardet = "==3.0.4"
configparser = "==4.0.2"
contextlib2 = "==0.6.0.post1"
coverage = "==5.0.1"
cryptography = "==3.3.2"
docker = "==4.1.0"
dockerpty = "==0.4.1"
docopt = "==0.6.2"
enum34 = "==1.1.6"
execnet = "==1.7.1"
filelock = "==3.0.12"
funcsigs = "==1.0.2"
idna = "==2.8"
importlib-metadata = "==1.3.0"
ipaddress = "==1.0.23"
jsonschema = "==3.2.0"
more-itertools = "==5.0.0"
pathlib2 = "==2.3.5"
pluggy = "==0.13.1"
py = "==1.10.0"
pycparser = "==2.19"
pyparsing = "==2.4.6"
pyrsistent = "==0.15.6"
pytest = "==4.6.8"
pytest-cov = "==2.8.1"
pytest-forked = "==1.1.3"
pytest-xdist = "==1.31.0"
requests = "==2.28.1"
scandir = "==1.10.0"
six = "==1.13.0"
subprocess32 = "==3.5.4"
testinfra = "==3.3.0"
texttable = "==1.6.2"
toml = "==0.10.0"
tox = "==3.14.3"
urllib3 = "==1.26.5"
virtualenv = "==16.7.9"
wcwidth = "==0.1.7"
zipp = "==0.6.0"
"backports.shutil_get_terminal_size" = "==1.0.0"
"backports.ssl_match_hostname" = "==3.7.0.1"
Jinja2 = "==2.11.3"
MarkupSafe = "==1.1.1"
PyYAML = "==5.4"
websocket_client = "==0.57.0"
python-dotenv = "==0.17.1"
pytest = "==7.1.3"
pytest-xdist = "==2.5.0"
pytest-testinfra = "==6.8.0"
black = "==22.8.0"

[requires]
python_version = "3.8"
python_version = "3"
657 changes: 99 additions & 558 deletions test/Pipfile.lock

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions test/TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,8 @@ Should result in:

- An image named `pihole:[branch-name]` being built
- Tests being ran to confirm the image doesn't have any regressions

# Modify Pipfile

You can enter into the test docker image using `./build-and-test.sh enter`.
From there, you can `cd test` and execute any needed pipenv commands.
3 changes: 3 additions & 0 deletions test/cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ set -eux
docker build ./src --tag pihole:${GIT_TAG} --no-cache
docker images

# auto-format the pytest code
python -m black ./test/tests/

# TODO: Add junitxml output and have something consume it
# 2 parallel max b/c race condition with docker fixture (I think?)
py.test -vv -n 2 ./test/tests/
55 changes: 0 additions & 55 deletions test/requirements.txt

This file was deleted.

Loading

0 comments on commit a9ecd4e

Please sign in to comment.