From 78da16e64041f0710bcef436db99a245561d74f5 Mon Sep 17 00:00:00 2001 From: Davide D'Alto Date: Wed, 31 May 2023 17:40:24 +0200 Subject: [PATCH] Set connection pool timeout for multithreaded id generation tests I don't why, but without it, these tests can stop with a timeout exception. It happens to me wiht MySQL when I test the build with all databases and to Barry when testing MSSQL and JUnit 5. I will review this later --- .../reactive/MultithreadedIdentityGenerationTest.java | 6 ++++-- .../org/hibernate/reactive/MultithreadedInsertionTest.java | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/MultithreadedIdentityGenerationTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/MultithreadedIdentityGenerationTest.java index 5f6ab2dd8e..04adbecbf9 100644 --- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/MultithreadedIdentityGenerationTest.java +++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/MultithreadedIdentityGenerationTest.java @@ -46,6 +46,8 @@ import jakarta.persistence.Table; import static org.hibernate.cfg.AvailableSettings.SHOW_SQL; +import static org.hibernate.reactive.BaseReactiveTest.setDefaultProperties; +import static org.hibernate.reactive.provider.Settings.POOL_CONNECT_TIMEOUT; /** * This is a multi-threaded stress test, intentionally consuming some time. @@ -95,10 +97,10 @@ public static void setupSessionFactory() { vertxOptions.setBlockedThreadCheckIntervalUnit( TimeUnit.MINUTES ); vertx = Vertx.vertx( vertxOptions ); Configuration configuration = new Configuration(); + setDefaultProperties( configuration ); configuration.addAnnotatedClass( EntityWithGeneratedId.class ); - BaseReactiveTest.setDefaultProperties( configuration ); configuration.setProperty( SHOW_SQL, String.valueOf( LOG_SQL ) ); - BaseReactiveTest.setDefaultProperties( configuration ); + configuration.setProperty( POOL_CONNECT_TIMEOUT, String.valueOf( TIMEOUT_MINUTES * 60 * 1000 ) ); StandardServiceRegistryBuilder builder = new ReactiveServiceRegistryBuilder() .applySettings( configuration.getProperties() ) //Inject our custom vert.x instance: diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/MultithreadedInsertionTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/MultithreadedInsertionTest.java index f83bf1d459..3499de06fd 100644 --- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/MultithreadedInsertionTest.java +++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/MultithreadedInsertionTest.java @@ -36,6 +36,8 @@ import jakarta.persistence.Table; import static org.hibernate.cfg.AvailableSettings.SHOW_SQL; +import static org.hibernate.reactive.BaseReactiveTest.setDefaultProperties; +import static org.hibernate.reactive.provider.Settings.POOL_CONNECT_TIMEOUT; import static org.hibernate.reactive.util.impl.CompletionStages.loop; /** @@ -101,9 +103,10 @@ public static void setupSessionFactory() { vertxOptions.setBlockedThreadCheckIntervalUnit( TimeUnit.MINUTES ); vertx = Vertx.vertx( vertxOptions ); Configuration configuration = new Configuration(); + setDefaultProperties( configuration ); configuration.addAnnotatedClass( EntityWithGeneratedId.class ); - BaseReactiveTest.setDefaultProperties( configuration ); configuration.setProperty( SHOW_SQL, String.valueOf( LOG_SQL ) ); + configuration.setProperty( POOL_CONNECT_TIMEOUT, String.valueOf( TIMEOUT_MINUTES * 60 * 1000 ) ); StandardServiceRegistryBuilder builder = new ReactiveServiceRegistryBuilder() .applySettings( configuration.getProperties() ) //Inject our custom vert.x instance: