Skip to content

Commit

Permalink
Moved testkit python setup from testkit to here
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Wilhelmsson authored and 2hdddg committed Jan 12, 2021
1 parent 7a4803d commit 24143fc
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -28,3 +28,4 @@ integrationtests/data
dependency-reduced-pom.xml
venv
testkit-backend/bin/
testkit/CAs/
2 changes: 2 additions & 0 deletions testkit/.dockerignore
@@ -0,0 +1,2 @@
*.py

16 changes: 16 additions & 0 deletions testkit/Dockerfile
@@ -0,0 +1,16 @@
# Install Maven 3.6, Java 11, Java 8 and Python3
FROM maven:3.6.3-openjdk-8

RUN apt-get --quiet --quiet update \
&& apt-get --quiet --quiet install -y bash python3 \
&& rm -rf /var/lib/apt/lists/*

ENV PYTHON=python3
ENV JAVA_HOME=/usr/local/openjdk-8
ENV PATH=$JAVA_HOME/bin:$PATH

# Install our own CAs on the image.
# Assumes Linux Debian based image.
# JAVA_HOME needed by update-ca-certificates hook to update Java with changed system CAs.
COPY CAs/* /usr/local/share/ca-certificates/
RUN update-ca-certificates
14 changes: 14 additions & 0 deletions testkit/backend.py
@@ -0,0 +1,14 @@
"""
Executed in Java driver container.
Assumes driver and backend has been built.
Responsible for starting the test backend.
"""
import os, subprocess


if __name__ == "__main__":
err = open("/artifacts/backenderr.log", "w")
out = open("/artifacts/backendout.log", "w")
subprocess.check_call(
["java", "-jar", "testkit-backend/target/testkit-backend.jar"], stdout=out, stderr=err)

13 changes: 13 additions & 0 deletions testkit/build.py
@@ -0,0 +1,13 @@
"""
Executed in java driver container.
Responsible for building driver and test backend.
"""
import os, subprocess

def run(args):
subprocess.run(
args, universal_newlines=True, stderr=subprocess.STDOUT, check=True)

if __name__ == "__main__":
run(["mvn", "clean", "install", "-P", "!determine-revision", "-DskipTests"])

4 changes: 4 additions & 0 deletions testkit/integration.py
@@ -0,0 +1,4 @@

if __name__ == "__main__":
print("Integration tests not ported to testkit")

4 changes: 4 additions & 0 deletions testkit/stress.py
@@ -0,0 +1,4 @@

if __name__ == "__main__":
print("Stress tests not ported to testkit")

14 changes: 14 additions & 0 deletions testkit/unittests.py
@@ -0,0 +1,14 @@
"""
Executed in Java driver container.
Responsible for running unit tests.
Assumes driver has been setup by build script prior to this.
"""

import os, subprocess

def run(args):
subprocess.run(
args, universal_newlines=True, stderr=subprocess.STDOUT, check=True)

if __name__ == "__main__":
run(["mvn", "test", "-Dmaven.gitcommitid.skip"])

0 comments on commit 24143fc

Please sign in to comment.