Skip to content

Commit

Permalink
Set connection pool timeout for multithreaded id generation tests
Browse files Browse the repository at this point in the history
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
  • Loading branch information
DavideD committed May 31, 2023
1 parent 8f42710 commit 78da16e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 78da16e

Please sign in to comment.