30
30
31
31
import org .neo4j .driver .v1 .AuthToken ;
32
32
import org .neo4j .driver .v1 .AuthTokens ;
33
+ import org .neo4j .driver .v1 .util .Neo4jRunner ;
34
+ import org .neo4j .driver .v1 .util .ServerVersion ;
33
35
34
36
import static org .junit .Assume .assumeTrue ;
35
37
@@ -39,8 +41,6 @@ public class ClusterRule extends ExternalResource
39
41
private static final String PASSWORD = "test" ;
40
42
private static final int INITIAL_PORT = 20_000 ;
41
43
42
- // todo: neo4j version should come from environment variables
43
- private static final String NEO4J_VERSION = "3.1.0" ;
44
44
// todo: should be possible to configure (dynamically add/remove) cores and read replicas
45
45
private static final int CORE_COUNT = 3 ;
46
46
private static final int READ_REPLICA_COUNT = 2 ;
@@ -64,7 +64,8 @@ protected void before() throws Throwable
64
64
{
65
65
deleteClusterDir ();
66
66
67
- SharedCluster .install ( NEO4J_VERSION , CORE_COUNT , READ_REPLICA_COUNT , PASSWORD , INITIAL_PORT , CLUSTER_DIR );
67
+ SharedCluster .install ( parseNeo4jVersion (),
68
+ CORE_COUNT , READ_REPLICA_COUNT , PASSWORD , INITIAL_PORT , CLUSTER_DIR );
68
69
69
70
try
70
71
{
@@ -101,6 +102,15 @@ protected void after()
101
102
cluster .deleteData ();
102
103
}
103
104
105
+ private static String parseNeo4jVersion ()
106
+ {
107
+ String [] split = Neo4jRunner .NEOCTRL_ARGS .split ( "\\ s+" );
108
+ String version = split [split .length - 1 ];
109
+ // if the server version is older than 3.1 series, then ignore the tests
110
+ assumeTrue ( ServerVersion .version ( "Neo4j/" + version ).greaterThanOrEqual ( ServerVersion .v3_1_0 ) );
111
+ return version ;
112
+ }
113
+
104
114
private static void addShutdownHookToStopCluster ()
105
115
{
106
116
Runtime .getRuntime ().addShutdownHook ( new Thread ()
0 commit comments