Skip to content

Commit 4eb6f61

Browse files
committed
Fix up TestKit time warp backend
Including insights from porting the time warp functionality to the 6.x branch. This includes: * Docker file formatting * Docker file simplification * Fixing infinite loop in time warped backend build process
1 parent 5e234e8 commit 4eb6f61

File tree

5 files changed

+56
-31
lines changed

5 files changed

+56
-31
lines changed

testkit/.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
*.py
2-
!backend.py

testkit/Dockerfile

Lines changed: 41 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,48 @@ FROM ubuntu:20.04 AS base
44
ENV DEBIAN_FRONTEND=noninteractive
55
RUN apt-get update && \
66
apt-get install -y locales && \
7-
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
87
localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 && \
9-
rm -rf /var/lib/apt/lists/*
8+
apt-get clean && \
9+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
1010
ENV LANG=en_US.UTF-8
1111

1212
# Using apt-get update alone in a RUN statement causes caching issues and subsequent apt-get install instructions fail.
13-
RUN apt-get --quiet update && apt-get --quiet install -y \
14-
software-properties-common \
15-
bash \
16-
python3 \
17-
python3-pip \
18-
git \
19-
curl \
20-
tar \
21-
wget \
22-
&& rm -rf /var/lib/apt/lists/*
13+
RUN apt-get update && \
14+
apt-get install -y \
15+
software-properties-common \
16+
bash \
17+
python3 \
18+
python3-pip \
19+
git \
20+
curl \
21+
tar \
22+
wget && \
23+
apt-get clean && \
24+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
2325

2426
# Install Build Tools
2527
RUN apt-get update && \
2628
apt-get install -y --no-install-recommends \
27-
make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev \
28-
libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev \
29-
libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev \
29+
make \
30+
build-essential \
31+
libssl-dev \
32+
zlib1g-dev \
33+
libbz2-dev \
34+
libreadline-dev\
35+
libsqlite3-dev \
36+
wget \
37+
curl \
38+
llvm \
39+
libncurses5-dev \
40+
xz-utils \
41+
tk-dev\
42+
libxml2-dev \
43+
libxmlsec1-dev \
44+
libffi-dev \
45+
liblzma-dev\
3046
ca-certificates && \
31-
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
47+
apt-get clean && \
48+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
3249

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

82+
ARG TIME_WARP
83+
ENV DRIVER_TIME_WARP=$TIME_WARP
84+
6585

6686
FROM base-py-install AS backend-timewarp
6787
WORKDIR /home/root/testkit
6888
COPY requirements*.txt .
69-
COPY testkit/backend.py testkit/build.py testkit/_common.py .
89+
COPY testkit/backend.py testkit/build.py testkit/_common.py testkit/
7090
RUN sed -i 's|-e \..*$||' requirements*.txt
7191

72-
ARG TIME_WARP
7392
RUN for version in $PYTHON_VERSIONS; do \
74-
TEST_BACKEND_VERSION="python$version" python build.py && \
75-
python$version -m pip install --force-reinstall neo4j==${TIME_WARP}; \
93+
TEST_BACKEND_VERSION="python$version" python testkit/build.py && \
94+
python$version -m pip install --force-reinstall neo4j==$TIME_WARP; \
7695
done
7796
COPY testkitbackend ./testkitbackend
78-
ENTRYPOINT ["python", "backend.py"]
97+
ENTRYPOINT ["python", "testkit/backend.py"]
7998

8099

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

89108

90109
FROM backend${TIME_WARP:+"-timewarp"} AS final
91-
ARG TIME_WARP
92-
ENV DRIVER_TIME_WARP=$TIME_WARP
110+
RUN env
93111
WORKDIR /home/root/testkit
94112
EXPOSE 9876/tcp

testkit/_common.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222

2323
TEST_BACKEND_VERSION = os.getenv("TEST_BACKEND_VERSION", "python")
24+
DRIVER_TIME_WARP = os.getenv("DRIVER_TIME_WARP")
2425

2526

2627
def run(args, env=None):

testkit/build.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,20 @@
1616

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

19-
from _common import run_python
19+
from _common import (
20+
DRIVER_TIME_WARP,
21+
run_python,
22+
)
2023

2124

2225
if __name__ == "__main__":
23-
run_python(
24-
["-m", "pip", "install", "-U", "pip", "build"],
25-
warning_as_error=False,
26-
)
27-
run_python(["-m", "build", "."], warning_as_error=True)
26+
if not DRIVER_TIME_WARP:
27+
run_python(
28+
["-m", "pip", "install", "-U", "pip", "build"],
29+
warning_as_error=False,
30+
)
31+
run_python(["-m", "build", "."], warning_as_error=True)
32+
2833
run_python(
2934
["-m", "pip", "install", "-Ur", "requirements-dev.txt"],
3035
warning_as_error=False,

testkitbackend/time_warp_compat.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,9 @@ def _get_extra_testkit_features() -> frozenset[str]:
144144
BLOCKED_TESTKIT_FEATURES: te.Final[frozenset[str]] = (
145145
_get_blocked_testkit_features()
146146
)
147-
EXTRA_TESTKIT_FEATURES: te.Final[frozenset[str]] = frozenset()
147+
EXTRA_TESTKIT_FEATURES: te.Final[frozenset[str]] = (
148+
_get_extra_testkit_features()
149+
)
148150

149151

150152
if GQL_ERROR_SUPPORT:

0 commit comments

Comments
 (0)