Skip to content

Move testkit configuration to the driver source code #677

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 29, 2021
Merged
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
2 changes: 2 additions & 0 deletions testkit/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.py

20 changes: 20 additions & 0 deletions testkit/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM ubuntu:18.04

RUN apt-get update && \
apt-get install -y \
git \
curl \
python3 \
firefox \
nodejs \
npm \
&& rm -rf /var/lib/apt/lists/*

RUN npm install -g npm \
&& /bin/bash -c 'hash -d npm'
RUN npm install -g gulp

# Install our own CAs on the image.
# Assumes Linux Debian based image.
COPY CAs/* /usr/local/share/ca-certificates/
RUN update-ca-certificates
15 changes: 15 additions & 0 deletions testkit/backend.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""
Executed in Javascript driver container.
Assumes driver and backend has been built.
Responsible for starting the test backend.
"""
import os
import subprocess

if __name__ == "__main__":
goPath = "/home/build"
backendPath = os.path.join(goPath, "bin", "testkit-backend")
err = open("/artifacts/backenderr.log", "w")
out = open("/artifacts/backendout.log", "w")
subprocess.check_call(
["node", "build/testkit-backend/main.js"], stdout=out, stderr=err)
19 changes: 19 additions & 0 deletions testkit/build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"""
Executed in Javascript driver container.
Responsible for building driver and test backend.
"""
import os
import subprocess
import shutil


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


if __name__ == "__main__":
run(['rm', '-fr', 'node_modules', 'lib', 'build'])
run(["npm", "ci"])
run(["gulp", "nodejs"])
run(["gulp", "testkit-backend"])
13 changes: 13 additions & 0 deletions testkit/integration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import subprocess
import os


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


if __name__ == "__main__":
os.environ["TEST_NEO4J_IPV6_ENABLED"] = "False"
run(["gulp", "test-browser"])
run(["gulp", "test-nodejs-integration"])
14 changes: 14 additions & 0 deletions testkit/stress.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import subprocess
import os


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


if __name__ == "__main__":
os.environ['STRESS_TEST_MODE'] = 'fastest'
os.environ['RUNNING_TIME_IN_SECONDS'] = \
os.environ.get('TEST_NEO4J_STRESS_DURATION', 0)
run(["npm", "run", "run-stress-tests"])
16 changes: 16 additions & 0 deletions testkit/unittests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
Executed in Javascript driver container.
Responsible for running unit tests.
Assumes driver has been setup by build script prior to this.
"""
import subprocess


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


if __name__ == "__main__":
run(["gulp", "test-nodejs-unit"])
run(["gulp", "run-ts-declaration-tests"])