Skip to content

Commit b76dc73

Browse files
Peter Wilhelmsson2hdddg
authored andcommitted
Stress startable from testkit
Needed check on encryption on/off in test code by probing the scheme.
1 parent 24143fc commit b76dc73

File tree

4 files changed

+45
-6
lines changed

4 files changed

+45
-6
lines changed

driver/src/test/java/org/neo4j/driver/util/cc/LocalOrRemoteClusterExtension.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public AuthToken getAuthToken()
6363

6464
public Config.ConfigBuilder config( Config.ConfigBuilder builder )
6565
{
66-
if ( remoteClusterExists() )
66+
if ( useEncryption() )
6767
{
6868
builder.withEncryption();
6969
}
@@ -153,6 +153,20 @@ private static boolean remoteClusterExists()
153153
return remoteClusterUriFromSystemProperty() != null;
154154
}
155155

156+
private static boolean useEncryption()
157+
{
158+
URI uri = remoteClusterUriFromSystemProperty();
159+
if (uri == null) {
160+
return false;
161+
}
162+
String scheme = uri.getScheme();
163+
return
164+
scheme == "neo4j+ssc" ||
165+
scheme == "neo4j+s" ||
166+
scheme == "bolt+ssc" ||
167+
scheme == "bolt+s";
168+
}
169+
156170
private static URI remoteClusterUriFromSystemProperty()
157171
{
158172
String uri = System.getProperty( CLUSTER_URI_SYSTEM_PROPERTY_NAME );

testkit/build.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
Executed in java driver container.
33
Responsible for building driver and test backend.
44
"""
5-
import os, subprocess
5+
import subprocess
6+
67

78
def run(args):
89
subprocess.run(
910
args, universal_newlines=True, stderr=subprocess.STDOUT, check=True)
1011

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

testkit/stress.py

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,27 @@
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
110

211
if __name__ == "__main__":
3-
print("Stress tests not ported to testkit")
4-
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+
cmd = [
18+
"mvn", "surefire:test",
19+
"-Dtest=CausalClusteringStressIT,AbstractStressTestBase",
20+
"-DexternalClusterUri=%s" % uri,
21+
"-Dneo4jUserPassword=%s" % password,
22+
"-DthreadCount=10",
23+
"-DexecutionTimeSeconds=10",
24+
"-Dmaven.gitcommitid.skip=true",
25+
]
26+
subprocess.run(cmd, universal_newlines=True,
27+
stderr=subprocess.STDOUT, check=True, cwd="driver")

testkit/unittests.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
Responsible for running unit tests.
44
Assumes driver has been setup by build script prior to this.
55
"""
6+
import subprocess
67

7-
import os, subprocess
88

99
def run(args):
1010
subprocess.run(
1111
args, universal_newlines=True, stderr=subprocess.STDOUT, check=True)
1212

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

0 commit comments

Comments
 (0)