Skip to content

Commit e7c4027

Browse files
author
Zhen Li
committed
Fixing failing test ConnectionPoolIT#shouldRecoverFromDownedServer with 3.4 server on linux machines
The test fail may due to the restart of server takes longer than expected.
1 parent a7a6c2e commit e7c4027

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

driver/src/test/java/org/neo4j/driver/integration/ConnectionPoolIT.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ void shouldRecoverFromDownedServer() throws Throwable
9191
neo4j.forceRestartDb();
9292

9393
// Then we accept a hump with failing sessions, but demand that failures stop as soon as the server is back up.
94-
sessionGrabber.assertSessionsAvailableWithin( 60 );
94+
sessionGrabber.assertSessionsAvailableWithin( 120 );
9595
}
9696

9797
@Test
@@ -220,6 +220,7 @@ private class SessionGrabber implements Runnable
220220
private volatile boolean sessionsAreAvailable = false;
221221
private volatile boolean run = true;
222222
private volatile Throwable lastExceptionFromDriver;
223+
private final int sleepTimeout = 100;
223224

224225
SessionGrabber( Driver driver )
225226
{
@@ -228,7 +229,7 @@ private class SessionGrabber implements Runnable
228229

229230
public void start()
230231
{
231-
new Thread(this).start();
232+
new Thread( this ).start();
232233
}
233234

234235
@Override
@@ -251,6 +252,14 @@ public void run()
251252
lastExceptionFromDriver = e;
252253
sessionsAreAvailable = false;
253254
}
255+
try
256+
{
257+
Thread.sleep( sleepTimeout );
258+
}
259+
catch ( InterruptedException e )
260+
{
261+
throw new RuntimeException( e );
262+
}
254263
}
255264
} finally
256265
{
@@ -268,7 +277,7 @@ void assertSessionsAvailableWithin( int timeoutSeconds ) throws InterruptedExcep
268277
// Success!
269278
return;
270279
}
271-
Thread.sleep( 100 );
280+
Thread.sleep( sleepTimeout );
272281
}
273282

274283
// Failure - timeout :(

0 commit comments

Comments
 (0)