Skip to content

Commit df98b7f

Browse files
committed
Supervisord tests
1 parent 6d64318 commit df98b7f

File tree

5 files changed

+472
-157
lines changed

5 files changed

+472
-157
lines changed

.github/workflows/docker-pytest.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
python-version: [3.6, 3.7, 3.8, 3.9]
15-
linux-distro: ["ubuntu:latest", "debian:latest"]
14+
python-version: [2.6, 2.7, 3.6, 3.7, 3.8, 3.9, 3.10, 3.11, 3.12]
1615

1716
steps:
1817
- uses: actions/checkout@v4
@@ -24,8 +23,15 @@ jobs:
2423

2524
- name: Build the Docker image
2625
run: |
27-
docker build . --file Dockerfile --tag gtfonow_test:${{ matrix.python-version }} --build-arg PYTHON_VERSION=${{ matrix.python-version }} --build-arg LINUX_DISTRO=${{ matrix.linux-distro }}
26+
docker build . --file Dockerfile --tag gtfonow_test:${{ matrix.python-version }} --build-arg PYTHON_VERSION=${{ matrix.python-version }}
2827
2928
- name: Run tests
3029
run: |
31-
docker run gtfonow_test:${{ matrix.python-version }}
30+
docker run --name gtfonow_test:${{ matrix.python-version }} -d gtfonow_test:${{ matrix.python-version }}
31+
32+
- name: Run Pytest
33+
run: docker exec -it gtfonow_test:${{ matrix.python-version }} pytest -v
34+
- name: Upload coverage reports to Codecov
35+
uses: codecov/codecov-action@v3
36+
env:
37+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

Dockerfile

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,30 @@ FROM python:${PYTHON_VERSION}
77
# Set the working directory in the container
88

99
RUN apt-get update -y
10-
RUN apt-get install -y zip
10+
RUN apt-get install -y zip cron vim nano nmap systemctl supervisor openssh-server sudo
1111
RUN pip install pytest
1212
RUN chmod u+s $(which find)
13-
RUN useradd -ms /bin/bash lowpriv
13+
RUN chmod u+s $(which nmap)
14+
RUN chmod u+s $(which cp)
15+
RUN chmod u+s $(which tee)
16+
RUN chmod u+s $(which dd)
17+
RUN chmod u+s $(which mv)
18+
RUN chmod u+s $(which rbash)
1419

20+
RUN useradd -ms /bin/bash lowpriv
21+
RUN useradd -ms /bin/bash higherpriv
1522

23+
RUN echo "lowpriv ALL=(ALL) NOPASSWD: /usr/bin/head" >> /etc/sudoers
24+
RUN echo "lowpriv ALL=(higherpriv) NOPASSWD: /usr/bin/vim" >> /etc/sudoers
1625

17-
USER lowpriv
26+
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
27+
RUN mkdir /run/sshd
28+
# USER lowpriv
1829

1930
WORKDIR /home/lowpriv/
2031
COPY --chown=lowpriv:lowpriv . .
2132

22-
# Run pytest when the container launches
23-
# CMD ["pytest", "-v"]
24-
CMD ["pytest", "-v"]
33+
34+
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
35+
36+
#CMD ["pytest", "-v"]

0 commit comments

Comments
 (0)