diff --git a/src/test/java/com/neo4j/docker/neo4jadmin/TestBackupRestore.java b/src/test/java/com/neo4j/docker/neo4jadmin/TestBackupRestore.java index 714db9d6..8664fd23 100644 --- a/src/test/java/com/neo4j/docker/neo4jadmin/TestBackupRestore.java +++ b/src/test/java/com/neo4j/docker/neo4jadmin/TestBackupRestore.java @@ -105,11 +105,13 @@ private void testCanBackupAndRestore(boolean asDefaultUser, String password) thr { final String dbUser = "neo4j"; Path backupDir; + Path adminLogDir; // BACKUP // start a database and populate data try(GenericContainer neo4j = createDBContainer( asDefaultUser, password )) { + temporaryFolderManager.createFolderAndMountAsVolume(neo4j, "/logs"); Path dataDir = temporaryFolderManager.createFolderAndMountAsVolume(neo4j, "/data"); neo4j.start(); DatabaseIO dbio = new DatabaseIO( neo4j ); @@ -129,7 +131,7 @@ private void testCanBackupAndRestore(boolean asDefaultUser, String password) thr "--include-metadata=all", "--from=" + neoDBAddress, "neo4j" ); - + adminLogDir = temporaryFolderManager.createNamedFolderAndMountAsVolume(adminBackup, "admin-logs", "/logs"); backupDir = temporaryFolderManager.createFolderAndMountAsVolume(adminBackup, "/backups"); adminBackup.start(); @@ -164,6 +166,7 @@ private void testCanBackupAndRestore(boolean asDefaultUser, String password) thr "--overwrite-destination=true", "--from-path=/backups/" + backupFile.getName(), "neo4j" ); + temporaryFolderManager.mountHostFolderAsVolume( adminRestore, adminLogDir, "/logs" ); temporaryFolderManager.mountHostFolderAsVolume( adminRestore, backupDir, "/backups" ); temporaryFolderManager.mountHostFolderAsVolume( adminRestore, dataDir, "/data" ); adminRestore.start(); diff --git a/src/test/java/com/neo4j/docker/neo4jadmin/TestDumpLoad.java b/src/test/java/com/neo4j/docker/neo4jadmin/TestDumpLoad.java index 1e67abde..b3edb926 100644 --- a/src/test/java/com/neo4j/docker/neo4jadmin/TestDumpLoad.java +++ b/src/test/java/com/neo4j/docker/neo4jadmin/TestDumpLoad.java @@ -100,10 +100,13 @@ private void shouldCreateDumpAndLoadDump( boolean asDefaultUser, String password Path firstDataDir; Path secondDataDir; Path backupDir; + Path logs; + Path adminLogs; // start a database and populate it try(GenericContainer container = createDBContainer( asDefaultUser, password )) { + logs = temporaryFolderManager.createFolderAndMountAsVolume(container, "/logs"); firstDataDir = temporaryFolderManager.createNamedFolderAndMountAsVolume(container,"data1", "/data"); container.start(); DatabaseIO dbio = new DatabaseIO( container ); @@ -114,9 +117,10 @@ private void shouldCreateDumpAndLoadDump( boolean asDefaultUser, String password // use admin container to create dump try(GenericContainer admin = createAdminContainer( asDefaultUser )) { - temporaryFolderManager.mountHostFolderAsVolume( admin, firstDataDir, "/data" ); + adminLogs = temporaryFolderManager.createNamedFolderAndMountAsVolume(admin,"admin-logs", "/logs"); + temporaryFolderManager.mountHostFolderAsVolume(admin, firstDataDir, "/data"); backupDir = temporaryFolderManager.createFolderAndMountAsVolume(admin, "/backups"); - admin.withCommand( "neo4j-admin", "database", "dump", "neo4j", "--to-path=/backups" ); + admin.withCommand("neo4j-admin", "database", "dump", "neo4j", "--to-path=/backups"); admin.start(); } Assertions.assertTrue( backupDir.resolve( "neo4j.dump" ).toFile().exists(), "dump file not created"); @@ -126,6 +130,7 @@ private void shouldCreateDumpAndLoadDump( boolean asDefaultUser, String password try(GenericContainer admin = createAdminContainer( asDefaultUser )) { secondDataDir = temporaryFolderManager.createNamedFolderAndMountAsVolume(admin, "data2", "/data"); + temporaryFolderManager.mountHostFolderAsVolume(admin, adminLogs, "/logs"); temporaryFolderManager.mountHostFolderAsVolume( admin, backupDir, "/backups" ); admin.withCommand( "neo4j-admin", "database", "load", "neo4j", "--from-path=/backups" ); admin.start(); @@ -134,6 +139,7 @@ private void shouldCreateDumpAndLoadDump( boolean asDefaultUser, String password // verify data in 2nd data directory by starting a database and verifying data we populated earlier try(GenericContainer container = createDBContainer( asDefaultUser, password )) { + temporaryFolderManager.mountHostFolderAsVolume(container, logs, "/logs"); temporaryFolderManager.mountHostFolderAsVolume( container, secondDataDir, "/data" ); container.start(); DatabaseIO dbio = new DatabaseIO( container ); diff --git a/src/test/java/com/neo4j/docker/utils/Neo4jWaitStrategy.java b/src/test/java/com/neo4j/docker/utils/Neo4jWaitStrategy.java index 5dc2a91c..722349d3 100644 --- a/src/test/java/com/neo4j/docker/utils/Neo4jWaitStrategy.java +++ b/src/test/java/com/neo4j/docker/utils/Neo4jWaitStrategy.java @@ -61,9 +61,9 @@ protected void waitUntilReady() String fullCommand = "if [ -f /var/lib/neo4j/run/neo4j.pid ]; then\n" + doThreadDumpCmd + "\n" + - "else\n" + - "echo \"could not dump threads, Neo4j is not running.\"\n" + - "fi"; + "else\n" + + "echo >&2 \"could not dump threads, Neo4j is not running.\"\n" + + "fi"; Container.ExecResult threadDumpResponse = waitStrategyTarget.execInContainer("sh", "-c", fullCommand); log.warn(threadDumpResponse.getStderr()); }