Do not block indefinitely when querying SQL database

pull/35165/head
Andy Wilkinson 2 years ago
parent d7da77bda8
commit cec159110d

@ -16,6 +16,8 @@
package org.springframework.boot.docker.compose.service.connection.oracle;
import java.time.Duration;
import io.r2dbc.spi.ConnectionFactories;
import io.r2dbc.spi.ConnectionFactoryOptions;
import org.junit.jupiter.api.Test;
@ -49,7 +51,7 @@ class OracleR2dbcDockerComposeConnectionDetailsFactoryIntegrationTests extends A
.sql(DatabaseDriver.ORACLE.getValidationQuery())
.map((row, metadata) -> row.get(0))
.first()
.block();
.block(Duration.ofSeconds(30));
assertThat(result).isEqualTo("Hello");
}

@ -16,6 +16,8 @@
package org.springframework.boot.docker.compose.service.connection.sqlserver;
import java.time.Duration;
import io.r2dbc.spi.ConnectionFactories;
import io.r2dbc.spi.ConnectionFactoryOptions;
import org.junit.jupiter.api.Test;
@ -50,7 +52,7 @@ class SqlServerR2dbcDockerComposeConnectionDetailsFactoryIntegrationTests
.sql(DatabaseDriver.SQLSERVER.getValidationQuery())
.map((row, metadata) -> row.get(0))
.first()
.block();
.block(Duration.ofSeconds(30));
assertThat(result).isEqualTo(1);
}

@ -16,6 +16,8 @@
package org.springframework.boot.testcontainers.service.connection.r2dbc;
import java.time.Duration;
import io.r2dbc.spi.ConnectionFactory;
import org.junit.jupiter.api.Test;
import org.testcontainers.containers.OracleContainer;
@ -56,7 +58,7 @@ class OracleR2dbcContainerConnectionDetailsFactoryTests {
.sql(DatabaseDriver.ORACLE.getValidationQuery())
.map((row, metadata) -> row.get(0))
.first()
.block();
.block(Duration.ofSeconds(30));
assertThat(result).isEqualTo("Hello");
}

Loading…
Cancel
Save