Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update integration tests to pass again #171

Merged
merged 3 commits into from
Dec 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
FROM python:3
FROM python:3.10
RUN apt-get update
RUN apt-get install -y libsasl2-dev libldap2-dev libssl-dev
RUN mkdir /code
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get install -y libsasl2-dev libldap2-dev libssl-dev slapd ldap-utils

ENV VIRTUAL_ENV=/opt/venv
RUN python -m venv $VIRTUAL_ENV
ENV PATH=$VIRTUAL_ENV/bin:$PATH

WORKDIR /code
ADD requirements.txt /code/

ADD ./requirements.txt /code/requirements.txt
RUN pip install -r requirements.txt
ADD . /code/

CMD [ "python", "./runtests.py" ]
ADD . /code
RUN python setup.py test
RUN python setup.py install
RUN tests/slapd-regtest
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,9 @@ Issue history is at https://code.google.com/p/nsscache/issues/list
# Contributions

Please format your code with https://github.com/google/yapf (installable as `pip install yapf` or the `yapf3` package on Debian systems) before sending pull requests.

# Testing

The [`Dockerfile`](Dockerfile) sets up a container that then executes the python unit tests and [`tests/slapd-regtest`](tests/slapd-regtest) integration test. Execute that with `podman build .` to get a reproducible test environment.

The `Dockerfile` mimics the test environment used by the Github Actions workflow [`.github/workflows/ci.yml`](.github/workflows/ci.yml)
1 change: 1 addition & 0 deletions tests/slapd-regtest
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ setup_slapd() {
mkdir -p $WORKDIR/ldap
sed -e "s!@workdir@!$WORKDIR!" \
< ${TESTDIR}/slapd.conf.tmpl > $ARTIFACTS/slapd.conf
$SLAPD -VVV || true
$SLAPADD -d -1 -f $ARTIFACTS/slapd.conf -b dc=example,dc=com -l ${TESTDIR}/default.ldif
$SLAPD -h ldapi://${WORKDIR//\//%2F}%2Fldapi -f $ARTIFACTS/slapd.conf &
slappid=$!
Expand Down
4 changes: 2 additions & 2 deletions tests/slapd.conf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ loglevel -1
pidfile @workdir@/slapd.pid


moduleload back_bdb.la
moduleload back_mdb.la

database bdb
database mdb
suffix "dc=example,dc=com"
directory @workdir@/ldap