Skip to content

Commit ab2f679

Browse files
authored
Move testkit configuration to the driver source code (#677)
1 parent 08d5457 commit ab2f679

File tree

7 files changed

+99
-0
lines changed

7 files changed

+99
-0
lines changed

testkit/.dockerignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.py
2+

testkit/Dockerfile

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM ubuntu:18.04
2+
3+
RUN apt-get update && \
4+
apt-get install -y \
5+
git \
6+
curl \
7+
python3 \
8+
firefox \
9+
nodejs \
10+
npm \
11+
&& rm -rf /var/lib/apt/lists/*
12+
13+
RUN npm install -g npm \
14+
&& /bin/bash -c 'hash -d npm'
15+
RUN npm install -g gulp
16+
17+
# Install our own CAs on the image.
18+
# Assumes Linux Debian based image.
19+
COPY CAs/* /usr/local/share/ca-certificates/
20+
RUN update-ca-certificates

testkit/backend.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"""
2+
Executed in Javascript driver container.
3+
Assumes driver and backend has been built.
4+
Responsible for starting the test backend.
5+
"""
6+
import os
7+
import subprocess
8+
9+
if __name__ == "__main__":
10+
goPath = "/home/build"
11+
backendPath = os.path.join(goPath, "bin", "testkit-backend")
12+
err = open("/artifacts/backenderr.log", "w")
13+
out = open("/artifacts/backendout.log", "w")
14+
subprocess.check_call(
15+
["node", "build/testkit-backend/main.js"], stdout=out, stderr=err)

testkit/build.py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"""
2+
Executed in Javascript driver container.
3+
Responsible for building driver and test backend.
4+
"""
5+
import os
6+
import subprocess
7+
import shutil
8+
9+
10+
def run(args, env=None):
11+
subprocess.run(
12+
args, universal_newlines=True, stderr=subprocess.STDOUT, check=True, env=env)
13+
14+
15+
if __name__ == "__main__":
16+
run(['rm', '-fr', 'node_modules', 'lib', 'build'])
17+
run(["npm", "ci"])
18+
run(["gulp", "nodejs"])
19+
run(["gulp", "testkit-backend"])

testkit/integration.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import subprocess
2+
import os
3+
4+
5+
def run(args):
6+
subprocess.run(
7+
args, universal_newlines=True, stderr=subprocess.STDOUT, check=True)
8+
9+
10+
if __name__ == "__main__":
11+
os.environ["TEST_NEO4J_IPV6_ENABLED"] = "False"
12+
run(["gulp", "test-browser"])
13+
run(["gulp", "test-nodejs-integration"])

testkit/stress.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import subprocess
2+
import os
3+
4+
5+
def run(args):
6+
subprocess.run(
7+
args, universal_newlines=True, stderr=subprocess.STDOUT, check=True)
8+
9+
10+
if __name__ == "__main__":
11+
os.environ['STRESS_TEST_MODE'] = 'fastest'
12+
os.environ['RUNNING_TIME_IN_SECONDS'] = \
13+
os.environ.get('TEST_NEO4J_STRESS_DURATION', 0)
14+
run(["npm", "run", "run-stress-tests"])

testkit/unittests.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
Executed in Javascript 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(["gulp", "test-nodejs-unit"])
16+
run(["gulp", "run-ts-declaration-tests"])

0 commit comments

Comments
 (0)