Skip to content

Commit d59247f

Browse files
gtroitskmichalvavrik
authored andcommitted
Remove excessive test and todo note in PostgresPoolTest
1 parent b06f3ad commit d59247f

File tree

1 file changed

+1
-51
lines changed

1 file changed

+1
-51
lines changed

303-quarkus-vertx-sql/src/test/java/io/quarkus/qe/vertx/sql/dbpool/PostgresPoolTest.java

+1-51
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,13 @@
44
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
55
import static org.junit.jupiter.api.Assertions.assertEquals;
66
import static org.junit.jupiter.api.Assertions.assertTrue;
7-
import static org.junit.jupiter.api.Assertions.fail;
87

98
import java.time.Duration;
10-
import java.time.OffsetDateTime;
11-
import java.util.ArrayList;
12-
import java.util.List;
139
import java.util.concurrent.CountDownLatch;
1410
import java.util.concurrent.TimeUnit;
15-
import java.util.concurrent.atomic.AtomicInteger;
1611

1712
import org.eclipse.microprofile.config.inject.ConfigProperty;
1813
import org.junit.jupiter.api.BeforeAll;
19-
import org.junit.jupiter.api.Disabled;
2014
import org.junit.jupiter.api.DisplayName;
2115
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
2216
import org.junit.jupiter.api.Order;
@@ -26,9 +20,7 @@
2620
import io.quarkus.qe.vertx.sql.test.resources.PostgresqlTestProfile;
2721
import io.quarkus.test.junit.QuarkusTest;
2822
import io.quarkus.test.junit.TestProfile;
29-
import io.smallrye.mutiny.Multi;
3023
import io.smallrye.mutiny.Uni;
31-
import io.vertx.core.Handler;
3224
import io.vertx.core.impl.logging.Logger;
3325
import io.vertx.core.impl.logging.LoggerFactory;
3426
import io.vertx.core.json.JsonArray;
@@ -38,7 +30,6 @@
3830
import io.vertx.mutiny.ext.web.client.WebClient;
3931
import io.vertx.mutiny.ext.web.client.predicate.ResponsePredicate;
4032
import io.vertx.mutiny.pgclient.PgPool;
41-
import io.vertx.mutiny.sqlclient.Row;
4233
import io.vertx.mutiny.sqlclient.RowSet;
4334

4435
import jakarta.inject.Inject;
@@ -135,47 +126,6 @@ public void checkIdleExpirationTime() throws InterruptedException {
135126
assertEquals(doneIdleExpired.getCount(), 0, "Missing doneIdleExpired query.");
136127
}
137128

138-
@Test
139-
@DisplayName("Idle issue: Fail to read any response from the server, the underlying connection might get lost unexpectedly.")
140-
@Order(3)
141-
@Disabled("Takes too much time and is fixed by Vertx 4.1")
142-
public void checkBorderConditionBetweenIdleAndGetConnection() {
143-
try {
144-
long idleMs = TimeUnit.SECONDS.toMillis(idle);
145-
latch = new CountDownLatch(1); // ignore, this test will run until Timeout or get an error occurs.
146-
AtomicInteger at = new AtomicInteger(0);
147-
Handler<Long> handler = l -> {
148-
LOGGER.info("###################################################: ");
149-
Multi.createFrom().range(1, 3)
150-
.concatMap(n -> {
151-
LOGGER.info("Connection #" + at.incrementAndGet());
152-
return postgresql.preparedQuery("SELECT CURRENT_TIMESTAMP")
153-
.execute().onFailure().invoke(error -> {
154-
LOGGER.info("Error: " + at.get());
155-
LOGGER.error("Error on query: '" + error.getMessage() + "'");
156-
latch.countDown();
157-
fail(error.getMessage());
158-
}).map(RowSet::iterator).onItem().transform(iterator -> {
159-
OffsetDateTime result = OffsetDateTime.now();
160-
if (iterator.hasNext()) {
161-
Row row = iterator.next();
162-
LOGGER.info("Result : " + at.get() + " : " + row.getOffsetDateTime(0));
163-
result = row.getOffsetDateTime(0);
164-
}
165-
return result;
166-
}).toMulti();
167-
}).collect().in(ArrayList::new, List::add).subscribe().with(re -> {
168-
LOGGER.info("Subscribe success: -> " + re.get(0));
169-
}, Throwable::printStackTrace);
170-
};
171-
Vertx.vertx().setPeriodic(idleMs + 3, l -> handler.handle(l));
172-
await(5, TimeUnit.MINUTES);
173-
} catch (IllegalStateException ex) {
174-
} finally {
175-
assertEquals(1, latch.getCount(), "An unexpected error was thrown.");
176-
}
177-
}
178-
179129
private Uni<Long> activeConnections() {
180130
return postgresql.query(
181131
"SELECT count(*) as active_con FROM pg_stat_activity where application_name like '%vertx%'")
@@ -195,7 +145,7 @@ protected String getAppEndpoint() {
195145
}
196146

197147
private boolean checkDbActiveConnections(long active) {
198-
return active <= datasourceMaxSize + (7); // TODO: double check this condition ... this magical number is scary!.
148+
return active <= datasourceMaxSize;
199149
}
200150

201151
}

0 commit comments

Comments
 (0)