Skip to content

Commit 24143fc

Browse files
Peter Wilhelmsson2hdddg
authored andcommitted
Moved testkit python setup from testkit to here
1 parent 7a4803d commit 24143fc

File tree

8 files changed

+68
-0
lines changed

8 files changed

+68
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ integrationtests/data
2828
dependency-reduced-pom.xml
2929
venv
3030
testkit-backend/bin/
31+
testkit/CAs/

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

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: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
if __name__ == "__main__":
3+
print("Stress tests not ported to testkit")
4+

testkit/unittests.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 running unit tests.
4+
Assumes driver has been setup by build script prior to this.
5+
"""
6+
7+
import os, subprocess
8+
9+
def run(args):
10+
subprocess.run(
11+
args, universal_newlines=True, stderr=subprocess.STDOUT, check=True)
12+
13+
if __name__ == "__main__":
14+
run(["mvn", "test", "-Dmaven.gitcommitid.skip"])

0 commit comments

Comments
 (0)