Skip to content

Commit 7ca9aba

Browse files
committed
Imported testkit directory
1 parent 10da2e2 commit 7ca9aba

File tree

7 files changed

+99
-0
lines changed

7 files changed

+99
-0
lines changed

testkit/.dockerignore

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

testkit/Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Install Maven 3.6, Java 11, Java 8 and Python3
2+
FROM maven:3.6.3-openjdk-8
3+
4+
RUN apt-get --quiet --quiet update \
5+
&& apt-get --quiet --quiet install -y bash python3 \
6+
&& rm -rf /var/lib/apt/lists/*
7+
8+
ENV PYTHON=python3
9+
ENV JAVA_HOME=/usr/local/openjdk-8
10+
ENV PATH=$JAVA_HOME/bin:$PATH
11+
12+
# Install our own CAs on the image.
13+
# Assumes Linux Debian based image.
14+
# JAVA_HOME needed by update-ca-certificates hook to update Java with changed system CAs.
15+
COPY CAs/* /usr/local/share/ca-certificates/
16+
RUN update-ca-certificates

testkit/backend.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
"""
2+
Executed in Java driver container.
3+
Assumes driver and backend has been built.
4+
Responsible for starting the test backend.
5+
"""
6+
import os, subprocess
7+
8+
9+
if __name__ == "__main__":
10+
err = open("/artifacts/backenderr.log", "w")
11+
out = open("/artifacts/backendout.log", "w")
12+
subprocess.check_call(
13+
["java", "-jar", "testkit-backend/target/testkit-backend.jar"], stdout=out, stderr=err)
14+

testkit/build.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
"""
2+
Executed in java driver container.
3+
Responsible for building driver and test backend.
4+
"""
5+
import subprocess
6+
7+
8+
def run(args):
9+
subprocess.run(
10+
args, universal_newlines=True, stderr=subprocess.STDOUT, check=True)
11+
12+
13+
if __name__ == "__main__":
14+
run(["mvn", "clean", "install", "-P", "!determine-revision", "-DskipTests"])

testkit/integration.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
if __name__ == "__main__":
3+
print("Integration tests not ported to testkit")
4+

testkit/stress.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
"""
2+
Executed in java driver container.
3+
Responsible for invoking Java stress test suite.
4+
The stress test might be invoked multiple times against different versions
5+
of Neo4j.
6+
Assumes driver has been built before.
7+
"""
8+
import subprocess
9+
import os
10+
11+
if __name__ == "__main__":
12+
uri = "%s://%s:%s" % (
13+
os.environ["TEST_NEO4J_SCHEME"],
14+
os.environ["TEST_NEO4J_HOST"],
15+
os.environ["TEST_NEO4J_PORT"])
16+
password = os.environ["TEST_NEO4J_PASS"]
17+
is_cluster = os.environ.get("TEST_NEO4J_IS_CLUSTER", False)
18+
if is_cluster:
19+
suite = "CausalClusteringStressIT"
20+
else:
21+
suite = "SingleInstanceStressIT"
22+
23+
cmd = [
24+
"mvn", "surefire:test",
25+
"--file", "./driver/pom.xml",
26+
"-Dtest=%s,AbstractStressTestBase" % suite,
27+
"-DexternalClusterUri=%s" % uri,
28+
"-Dneo4jUserPassword=%s" % password,
29+
"-DthreadCount=10",
30+
"-DexecutionTimeSeconds=10",
31+
"-Dmaven.gitcommitid.skip=true",
32+
]
33+
subprocess.run(cmd, universal_newlines=True,
34+
stderr=subprocess.STDOUT, check=True)

testkit/unittests.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"""
2+
Executed in Java driver container.
3+
Responsible for running unit tests.
4+
Assumes driver has been setup by build script prior to this.
5+
"""
6+
import subprocess
7+
8+
9+
def run(args):
10+
subprocess.run(
11+
args, universal_newlines=True, stderr=subprocess.STDOUT, check=True)
12+
13+
14+
if __name__ == "__main__":
15+
run(["mvn", "test", "-Dmaven.gitcommitid.skip"])

0 commit comments

Comments
 (0)