Skip to content

Commit 866089b

Browse files
Add open options settings for test configs
Previously some module options were hardcoded in neo4j. Now they are part of distributes neo4j config. As a result, if config gets lost or changed for test purposes we need to make sure we have a minimal set of options that will actually allow neo4j to be started.
1 parent 34cd62c commit 866089b

File tree

7 files changed

+35
-5
lines changed

7 files changed

+35
-5
lines changed

src/test/java/com/neo4j/docker/neo4jserver/TestMounting.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
import org.testcontainers.containers.wait.strategy.Wait;
2323

2424
import java.io.IOException;
25+
import java.nio.file.Files;
2526
import java.nio.file.Path;
27+
import java.nio.file.Paths;
2628
import java.time.Duration;
2729
import java.util.Random;
2830
import java.util.function.Consumer;
@@ -240,6 +242,9 @@ void testCantWriteIfSecureEnabledAndNoPermissions_logs() throws IOException
240242
void canMountAllTheThings_fileMounts(boolean asCurrentUser) throws Exception
241243
{
242244
Path testOutputFolder = HostFileSystemOperations.createTempFolder( "mount-everything-" );
245+
Path confFile = Paths.get( "src", "test", "resources", "confs", "MountConf.conf" );
246+
Files.copy( confFile, testOutputFolder.resolve( "neo4j.conf" ) );
247+
243248
try(GenericContainer container = setupBasicContainer( asCurrentUser, false ))
244249
{
245250
HostFileSystemOperations.createTempFolderAndMountAsVolume( container, "conf", "/conf", testOutputFolder );
@@ -263,12 +268,16 @@ void canMountAllTheThings_fileMounts(boolean asCurrentUser) throws Exception
263268
@ValueSource(booleans = {true, false})
264269
void canMountAllTheThings_namedVolumes(boolean asCurrentUser) throws Exception
265270
{
271+
Path testOutputFolder = HostFileSystemOperations.createTempFolder( "namedmount-everything-" );
272+
Path confFile = Paths.get( "src", "test", "resources", "confs", "NamedMountConf.conf" );
273+
Files.copy( confFile, testOutputFolder.resolve( "neo4j.conf" ) );
274+
266275
String id = String.format( "%04d", new Random().nextInt( 10000 ));
267276
try(GenericContainer container = setupBasicContainer( asCurrentUser, false ))
268277
{
269278
container.withCreateContainerCmdModifier(
270279
(Consumer<CreateContainerCmd>) cmd -> cmd.getHostConfig().withBinds(
271-
Bind.parse("conf-"+id+":/conf"),
280+
Bind.parse( "conf-" + id + ":/" + testOutputFolder.toAbsolutePath() ),
272281
Bind.parse("data-"+id+":/data"),
273282
Bind.parse("import-"+id+":/import"),
274283
Bind.parse("logs-"+id+":/logs"),
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
causal_clustering.transaction_advertised_address=localhost:6060
1+
causal_clustering.transaction_advertised_address=localhost:6060
2+
3+
dbms.jvm.additional=--add-opens=java.base/java.nio=ALL-UNNAMED
4+
dbms.jvm.additional=--add-opens=java.base/java.io=ALL-UNNAMED
5+
dbms.jvm.additional=--add-opens=java.base/sun.nio.ch=ALL-UNNAMED
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
dbms.memory.pagecache.size=1000m
1+
dbms.memory.pagecache.size=1000m
2+
3+
dbms.jvm.additional=--add-opens=java.base/java.nio=ALL-UNNAMED
4+
dbms.jvm.additional=--add-opens=java.base/java.io=ALL-UNNAMED
5+
dbms.jvm.additional=--add-opens=java.base/sun.nio.ch=ALL-UNNAMED
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
dbms.logs.http.rotation.keep_number=$(expr 2 * 10)
1+
dbms.logs.http.rotation.keep_number=$(expr 2 * 10)
2+
dbms.jvm.additional=--add-opens=java.base/java.nio=ALL-UNNAMED
3+
dbms.jvm.additional=--add-opens=java.base/java.io=ALL-UNNAMED
4+
dbms.jvm.additional=--add-opens=java.base/sun.nio.ch=ALL-UNNAMED
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dbms.jvm.additional=--add-opens=java.base/java.nio=ALL-UNNAMED
2+
dbms.jvm.additional=--add-opens=java.base/java.io=ALL-UNNAMED
3+
dbms.jvm.additional=--add-opens=java.base/sun.nio.ch=ALL-UNNAMED
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dbms.jvm.additional=--add-opens=java.base/java.nio=ALL-UNNAMED
2+
dbms.jvm.additional=--add-opens=java.base/java.io=ALL-UNNAMED
3+
dbms.jvm.additional=--add-opens=java.base/sun.nio.ch=ALL-UNNAMED
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
dbms.memory.heap.max_size=512m
1+
dbms.memory.heap.max_size=512m
2+
3+
dbms.jvm.additional=--add-opens=java.base/java.nio=ALL-UNNAMED
4+
dbms.jvm.additional=--add-opens=java.base/java.io=ALL-UNNAMED
5+
dbms.jvm.additional=--add-opens=java.base/sun.nio.ch=ALL-UNNAMED

0 commit comments

Comments
 (0)