Skip to content
Open
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
1 change: 0 additions & 1 deletion testkit/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
*.py
!backend.py
64 changes: 41 additions & 23 deletions testkit/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,48 @@ FROM ubuntu:20.04 AS base
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y locales && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 && \
rm -rf /var/lib/apt/lists/*
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ENV LANG=en_US.UTF-8

# Using apt-get update alone in a RUN statement causes caching issues and subsequent apt-get install instructions fail.
RUN apt-get --quiet update && apt-get --quiet install -y \
software-properties-common \
bash \
python3 \
python3-pip \
git \
curl \
tar \
wget \
&& rm -rf /var/lib/apt/lists/*
RUN apt-get update && \
apt-get install -y \
software-properties-common \
bash \
python3 \
python3-pip \
git \
curl \
tar \
wget && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Install Build Tools
RUN apt-get update && \
apt-get install -y --no-install-recommends \
make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev \
libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev \
libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev \
make \
build-essential \
libssl-dev \
zlib1g-dev \
libbz2-dev \
libreadline-dev\
libsqlite3-dev \
wget \
curl \
llvm \
libncurses5-dev \
xz-utils \
tk-dev\
libxml2-dev \
libxmlsec1-dev \
libffi-dev \
liblzma-dev\
ca-certificates && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Install pyenv
RUN git clone https://github.com/pyenv/pyenv.git .pyenv
Expand Down Expand Up @@ -62,20 +79,22 @@ RUN for version in $PYTHON_VERSIONS; do \
python$version -m pip install -U coverage tox; \
done

ARG TIME_WARP
ENV DRIVER_TIME_WARP=$TIME_WARP


FROM base-py-install AS backend-timewarp
WORKDIR /home/root/testkit
COPY requirements*.txt .
COPY testkit/backend.py testkit/build.py testkit/_common.py .
COPY testkit/backend.py testkit/build.py testkit/_common.py testkit/
RUN sed -i 's|-e \..*$||' requirements*.txt

ARG TIME_WARP
RUN for version in $PYTHON_VERSIONS; do \
TEST_BACKEND_VERSION="python$version" python build.py && \
python$version -m pip install --force-reinstall neo4j==${TIME_WARP}; \
TEST_BACKEND_VERSION="python$version" python testkit/build.py && \
python$version -m pip install --force-reinstall neo4j==$TIME_WARP; \
done
COPY testkitbackend ./testkitbackend
ENTRYPOINT ["python", "backend.py"]
ENTRYPOINT ["python", "testkit/backend.py"]


FROM base-py-install AS backend
Expand All @@ -88,7 +107,6 @@ RUN update-ca-certificates


FROM backend${TIME_WARP:+"-timewarp"} AS final
ARG TIME_WARP
ENV DRIVER_TIME_WARP=$TIME_WARP
RUN env
WORKDIR /home/root/testkit
EXPOSE 9876/tcp
1 change: 1 addition & 0 deletions testkit/_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@


TEST_BACKEND_VERSION = os.getenv("TEST_BACKEND_VERSION", "python")
DRIVER_TIME_WARP = os.getenv("DRIVER_TIME_WARP")


def run(args, env=None):
Expand Down
17 changes: 11 additions & 6 deletions testkit/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,20 @@

"""Building driver and test backend inside driver container."""

from _common import run_python
from _common import (
DRIVER_TIME_WARP,
run_python,
)


if __name__ == "__main__":
run_python(
["-m", "pip", "install", "-U", "pip", "build"],
warning_as_error=False,
)
run_python(["-m", "build", "."], warning_as_error=True)
if not DRIVER_TIME_WARP:
run_python(
["-m", "pip", "install", "-U", "pip", "build"],
warning_as_error=False,
)
run_python(["-m", "build", "."], warning_as_error=True)

run_python(
["-m", "pip", "install", "-Ur", "requirements-dev.txt"],
warning_as_error=False,
Expand Down
6 changes: 3 additions & 3 deletions testkitbackend/time_warp_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,15 @@ def _get_blocked_testkit_features() -> frozenset[str]:

def _get_extra_testkit_features() -> frozenset[str]:
extra: list[str] = []
if VERSION < (5, 28):
extra.extend(("Feature:Bolt:4.0",))
return frozenset(extra)


BLOCKED_TESTKIT_FEATURES: te.Final[frozenset[str]] = (
_get_blocked_testkit_features()
)
EXTRA_TESTKIT_FEATURES: te.Final[frozenset[str]] = frozenset()
EXTRA_TESTKIT_FEATURES: te.Final[frozenset[str]] = (
_get_extra_testkit_features()
)


if GQL_ERROR_SUPPORT:
Expand Down