Skip to content

Commit

Permalink
try adding timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
vga91 committed Sep 6, 2024
1 parent 3087f47 commit 86655ed
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import java.net.MalformedURLException;
import java.net.URL;
import java.time.Duration;
import java.util.List;
import java.util.Map;

Expand All @@ -37,7 +38,9 @@ public class MissingExtraDependenciesTest {
@BeforeClass
public static void setUp() throws Exception {
neo4jContainer = createEnterpriseDB(List.of(TestContainerUtil.ApocPackage.EXTENDED), true);
neo4jContainer.setWaitStrategy(Wait.defaultWaitStrategy());
neo4jContainer.setWaitStrategy(Wait.defaultWaitStrategy()
.withStartupTimeout(Duration.ofMinutes(10)));
neo4jContainer.withStartupTimeout(Duration.ofMinutes(10));
neo4jContainer.start();

session = neo4jContainer.getSession();
Expand Down
4 changes: 3 additions & 1 deletion extended-it/src/test/java/apoc/neo4j/docker/BoltTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.neo4j.test.rule.ImpermanentDbmsRule;
import org.testcontainers.containers.wait.strategy.Wait;

import java.time.Duration;
import java.time.LocalTime;
import java.time.OffsetTime;
import java.util.Arrays;
Expand Down Expand Up @@ -61,7 +62,8 @@ public class BoltTest {
@BeforeClass
public static void setUp() throws Exception {
neo4jContainer = createEnterpriseDB(List.of(ApocPackage.EXTENDED, ApocPackage.CORE), true).withInitScript("init_neo4j_bolt.cypher");
neo4jContainer.setWaitStrategy(Wait.defaultWaitStrategy());
neo4jContainer.setWaitStrategy(Wait.defaultWaitStrategy()
.withStartupTimeout(Duration.ofMinutes(10)));neo4jContainer.withStartupTimeout(Duration.ofMinutes(10));
neo4jContainer.start();
TestUtil.registerProcedure(db, Bolt.class, ExportCypher.class, Cypher.class, PathExplorer.class, GraphRefactoring.class);
BOLT_URL = getBoltUrl().replaceAll("'", "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.neo4j.driver.Session;
import org.testcontainers.containers.wait.strategy.Wait;

import java.time.Duration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand All @@ -33,7 +34,9 @@ public void checkForCoreAndExtended() {
try(Neo4jContainerExtension neo4jContainer = createEnterpriseDB(List.of(ApocPackage.CORE, ApocPackage.EXTENDED), true)
.withNeo4jConfig("dbms.transaction.timeout", "60s")
.withEnv(APOC_IMPORT_FILE_ENABLED, "true")) {
neo4jContainer.setWaitStrategy(Wait.defaultWaitStrategy());
neo4jContainer.setWaitStrategy(Wait.defaultWaitStrategy()
.withStartupTimeout(Duration.ofMinutes(10)));
neo4jContainer.withStartupTimeout(Duration.ofMinutes(10));
neo4jContainer.start();

Session session = neo4jContainer.getSession();
Expand All @@ -56,7 +59,9 @@ public void matchesSpreadsheet() {
try(Neo4jContainerExtension neo4jContainer = createEnterpriseDB(List.of(TestContainerUtil.ApocPackage.CORE, TestContainerUtil.ApocPackage.EXTENDED), true)
.withNeo4jConfig("dbms.transaction.timeout", "60s")
.withEnv(APOC_IMPORT_FILE_ENABLED, "true")) {
neo4jContainer.setWaitStrategy(Wait.defaultWaitStrategy());
neo4jContainer.setWaitStrategy(Wait.defaultWaitStrategy()
.withStartupTimeout(Duration.ofMinutes(10)));
neo4jContainer.withStartupTimeout(Duration.ofMinutes(10));
neo4jContainer.start();

Session session = neo4jContainer.getSession();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import java.io.File;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -64,13 +65,17 @@ public class CypherEnterpriseExtendedTest {

private static Neo4jContainerExtension neo4jContainer;
private static Session session;



@BeforeClass
public static void beforeAll() {
// We build the project, the artifact will be placed into ./build/libs
neo4jContainer = createEnterpriseDB(List.of(ApocPackage.EXTENDED), true)
.withNeo4jConfig("dbms.transaction.timeout", "60s");
neo4jContainer.setWaitStrategy(Wait.defaultWaitStrategy());
neo4jContainer.setWaitStrategy(Wait.defaultWaitStrategy()
.withStartupTimeout(Duration.ofMinutes(10)));
neo4jContainer.withStartupTimeout(Duration.ofMinutes(10));
neo4jContainer.start();
session = neo4jContainer.getSession();

Expand Down
5 changes: 4 additions & 1 deletion extended-it/src/test/java/apoc/neo4j/docker/MetricsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.neo4j.driver.Session;
import org.testcontainers.containers.wait.strategy.Wait;

import java.time.Duration;
import java.util.List;
import java.util.Map;
import java.util.Set;
Expand Down Expand Up @@ -44,7 +45,9 @@ public static void beforeAll() throws InterruptedException {
.withNeo4jConfig("metrics.enabled", "true")
.withNeo4jConfig("metrics.csv.interval", "1s")
.withNeo4jConfig("metrics.namespaces.enabled", "true");
neo4jContainer.setWaitStrategy(Wait.defaultWaitStrategy());
neo4jContainer.setWaitStrategy(Wait.defaultWaitStrategy()
.withStartupTimeout(Duration.ofMinutes(10)));
neo4jContainer.withStartupTimeout(Duration.ofMinutes(10));
neo4jContainer.start();
session = neo4jContainer.getSession();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import java.io.File;
import java.io.IOException;
import java.time.Duration;
import java.util.List;
import java.util.UUID;

Expand Down Expand Up @@ -55,7 +56,9 @@ public static void beforeClass() throws Exception {
.withNeo4jConfig("dbms.security.keystore.path", pathPwdValue)
.withNeo4jConfig("dbms.security.keystore.password", PASSWORD)
.withNeo4jConfig("dbms.security.key.name", randomKeyAlias);
neo4jContainer.setWaitStrategy(Wait.defaultWaitStrategy());
neo4jContainer.setWaitStrategy(Wait.defaultWaitStrategy()
.withStartupTimeout(Duration.ofMinutes(10)));
neo4jContainer.withStartupTimeout(Duration.ofMinutes(10));
neo4jContainer.start();
session = neo4jContainer.getSession();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.neo4j.driver.SessionConfig;
import org.testcontainers.containers.wait.strategy.Wait;

import java.time.Duration;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
Expand Down Expand Up @@ -43,7 +44,8 @@ public static void setupContainer() {
"apoc.ttl.schedule." + DB_FOO, "7",
"apoc.ttl.limit", "200",
"apoc.ttl.limit." + DB_BAR, "2000"));
neo4jContainer.setWaitStrategy(Wait.defaultWaitStrategy());
neo4jContainer.setWaitStrategy(Wait.defaultWaitStrategy()
.withStartupTimeout(Duration.ofMinutes(10)));neo4jContainer.withStartupTimeout(Duration.ofMinutes(10));
neo4jContainer.start();
driver = neo4jContainer.getDriver();
createDatabases();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.neo4j.driver.*;
import org.testcontainers.containers.wait.strategy.Wait;

import java.time.Duration;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
Expand Down Expand Up @@ -48,7 +49,9 @@ public static void setupContainer() {
.withEnv(String.format(APOC_UUID_ENABLED_DB, DB_TEST), "false")
.withEnv(APOC_UUID_ENABLED, "true")
.withEnv(APOC_UUID_REFRESH, "1000");
neo4jContainer.setWaitStrategy(Wait.defaultWaitStrategy());
neo4jContainer.setWaitStrategy(Wait.defaultWaitStrategy()
.withStartupTimeout(Duration.ofMinutes(10)));
neo4jContainer.withStartupTimeout(Duration.ofMinutes(10));
neo4jContainer.start();
driver = neo4jContainer.getDriver();
SYS_CONF = SessionConfig.forDatabase(SYSTEM_DATABASE_NAME);
Expand Down

0 comments on commit 86655ed

Please sign in to comment.