Skip to content

Commit

Permalink
Fix swallowed failures in Reactive SQL Client tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yrodiere committed Jan 15, 2024
1 parent e3dd81b commit 7a3b734
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.quarkus.reactive.mssql.client;

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;

import jakarta.enterprise.context.ApplicationScoped;
Expand Down Expand Up @@ -41,10 +40,8 @@ static class BeanUsingBareMSSQLClient {
@Inject
MSSQLPool mssqlClient;

public CompletionStage<Void> verify() {
CompletableFuture<Void> cf = new CompletableFuture<>();
mssqlClient.query("SELECT 1").execute(ar -> cf.complete(null));
return cf;
public CompletionStage<?> verify() {
return mssqlClient.query("SELECT 1").execute().toCompletionStage();
}
}

Expand All @@ -57,7 +54,6 @@ static class BeanUsingMutinyMSSQLClient {
public CompletionStage<Void> verify() {
return mssqlClient.query("SELECT 1").execute()
.onItem().ignore().andContinueWithNull()
.onFailure().recoverWithItem((Void) null)
.subscribeAsCompletionStage();
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
quarkus.datasource.db-kind=mssql
quarkus.datasource.username=sa
quarkus.datasource.password=yourStrong(!)Password
quarkus.datasource.reactive.url=${reactive-mssql.url}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.quarkus.reactive.mysql.client;

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;

import jakarta.enterprise.context.ApplicationScoped;
Expand Down Expand Up @@ -40,10 +39,8 @@ static class BeanUsingBareMySQLClient {
@Inject
MySQLPool mysqlClient;

public CompletionStage<Void> verify() {
CompletableFuture<Void> cf = new CompletableFuture<>();
mysqlClient.query("SELECT 1").execute(ar -> cf.complete(null));
return cf;
public CompletionStage<?> verify() {
return mysqlClient.query("SELECT 1").execute().toCompletionStage();
}
}

Expand All @@ -56,7 +53,6 @@ static class BeanUsingMutinyMySQLClient {
public CompletionStage<Void> verify() {
return mysqlClient.query("SELECT 1").execute()
.onItem().ignore().andContinueWithNull()
.onFailure().recoverWithItem((Void) null)
.subscribeAsCompletionStage();
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
quarkus.datasource.db-kind=mysql
quarkus.datasource.username=hibernate_orm_test
quarkus.datasource.password=hibernate_orm_test
quarkus.datasource.reactive.url=${reactive-mysql.url}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.quarkus.reactive.oracle.client;

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;

import jakarta.enterprise.context.ApplicationScoped;
Expand Down Expand Up @@ -41,10 +40,8 @@ static class BeanUsingBareOracleClient {
@Inject
OraclePool oracleClient;

public CompletionStage<Void> verify() {
CompletableFuture<Void> cf = new CompletableFuture<>();
oracleClient.query("SELECT 1 FROM DUAL").execute(ar -> cf.complete(null));
return cf;
public CompletionStage<?> verify() {
return oracleClient.query("SELECT 1 FROM DUAL").execute().toCompletionStage();
}
}

Expand All @@ -57,7 +54,6 @@ static class BeanUsingMutinyOracleClient {
public CompletionStage<Void> verify() {
return oracleClient.query("SELECT 1 FROM DUAL").execute()
.onItem().ignore().andContinueWithNull()
.onFailure().recoverWithItem((Void) null)
.subscribeAsCompletionStage();
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
quarkus.datasource.db-kind=oracle
quarkus.datasource.username=SYSTEM
quarkus.datasource.password=hibernate_orm_test
quarkus.datasource.reactive.url=${reactive-oracledb.url}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.quarkus.reactive.pg.client;

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;

import jakarta.enterprise.context.ApplicationScoped;
Expand Down Expand Up @@ -41,10 +40,8 @@ static class BeanUsingBarePgClient {
@Inject
PgPool pgClient;

public CompletionStage<Void> verify() {
CompletableFuture<Void> cf = new CompletableFuture<>();
pgClient.query("SELECT 1").execute(ar -> cf.complete(null));
return cf;
public CompletionStage<?> verify() {
return pgClient.query("SELECT 1").execute().toCompletionStage();
}
}

Expand All @@ -57,7 +54,6 @@ static class BeanUsingMutinyPgClient {
public CompletionStage<Void> verify() {
return pgClient.query("SELECT 1").execute()
.onItem().ignore().andContinueWithNull()
.onFailure().recoverWithItem(() -> null)
.subscribeAsCompletionStage();
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
quarkus.datasource.db-kind=postgresql
quarkus.datasource.username=username-default
quarkus.datasource.username=hibernate_orm_test
quarkus.datasource.password=hibernate_orm_test
quarkus.datasource.reactive.url=${reactive-postgres.url}

0 comments on commit 7a3b734

Please sign in to comment.