Skip to content

Commit

Permalink
[gRNAet7B] Try fix flaky TriggerClusterRoutingTest (neo4j-contrib/neo…
Browse files Browse the repository at this point in the history
  • Loading branch information
vga91 committed Jan 5, 2023
1 parent b4e38f9 commit 4377223
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
11 changes: 8 additions & 3 deletions core/src/test/java/apoc/trigger/TriggerClusterRoutingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import static apoc.trigger.Trigger.SYS_NON_WRITER_ERROR;
import static apoc.trigger.TriggerNewProcedures.TRIGGER_NOT_ROUTED_ERROR;
import static apoc.util.TestContainerUtil.testCall;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
Expand Down Expand Up @@ -87,11 +88,15 @@ private static void triggerInSysLeaderMemberCommon(String query, String triggerN
Session session = driver.session(SessionConfig.forDatabase(dbName));
final String address = container.getEnvMap().get("NEO4J_dbms_connector_bolt_advertised__address");
if (dbIsWriter(session, dbName, address)) {
session.run(query, Map.of("name", UUID.randomUUID().toString())).consume();
final String name = UUID.randomUUID().toString();
testCall( session, query,
Map.of("name", name),
row -> assertEquals(name, row.get("name")) );
} else {
try {
session.run(query, Map.of("name", UUID.randomUUID().toString())).consume();
fail("Should fail because of non writer trigger addition");
testCall(session, query,
Map.of("name", UUID.randomUUID().toString()),
row -> fail("Should fail because of non writer trigger addition"));
} catch (Exception e) {
String errorMsg = e.getMessage();
assertTrue("The actual message is: " + errorMsg, errorMsg.contains(triggerNotRoutedError));
Expand Down
2 changes: 1 addition & 1 deletion core/src/test/java/apoc/trigger/TriggerTestUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import static org.junit.Assert.assertEquals;

public class TriggerTestUtil {
public static final long TIMEOUT = 10L;
public static final long TIMEOUT = 30L;

public static void awaitTriggerDiscovered(GraphDatabaseService db, String name, String query) {
awaitTriggerDiscovered(db, name, query, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import static org.neo4j.configuration.GraphDatabaseSettings.procedure_unrestricted;

public class TriggerNewProceduresExtendedTest {
private static final long TIMEOUT = 10L;
private static final long TIMEOUT = 30L;

private static final File directory = new File("target/conf");
static { //noinspection ResultOfMethodCallIgnored
Expand Down

0 comments on commit 4377223

Please sign in to comment.