#7461 Use less strict assertion for expiring pool to account for potential expirations

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
This commit is contained in:
Ludovic Orban 2022-02-02 11:10:09 +01:00
parent d42664ee1e
commit 4382bc122e
1 changed files with 6 additions and 1 deletions

View File

@ -54,6 +54,8 @@ import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.lessThanOrEqualTo;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
@ -316,7 +318,10 @@ public class ConnectionPoolTest
assertEquals(1, destinations.size());
HttpDestination destination = (HttpDestination)destinations.get(0);
AbstractConnectionPool connectionPool = (AbstractConnectionPool)destination.getConnectionPool();
assertEquals(2, connectionPool.getConnectionCount());
if (DUPLEX_MAX_DURATION == factory)
assertThat(connectionPool.getConnectionCount(), lessThanOrEqualTo(2)); // The connections can expire upon release.
else
assertThat(connectionPool.getConnectionCount(), is(2));
}
@ParameterizedTest