66package io .opentelemetry .instrumentation .viburdbcp ;
77
88import static io .opentelemetry .instrumentation .api .internal .SemconvStability .emitStableDatabaseSemconv ;
9- import static org .awaitility .Awaitility .await ;
109import static org .mockito .Mockito .when ;
1110
1211import io .opentelemetry .instrumentation .testing .junit .InstrumentationExtension ;
1312import io .opentelemetry .instrumentation .testing .junit .db .DbConnectionPoolMetricsAssertions ;
1413import java .sql .Connection ;
1514import java .sql .SQLException ;
16- import java .time .Duration ;
1715import javax .sql .DataSource ;
1816import org .assertj .core .api .AbstractIterableAssert ;
1917import org .junit .jupiter .api .Test ;
2523@ ExtendWith (MockitoExtension .class )
2624public abstract class AbstractViburInstrumentationTest {
2725 private static final String INSTRUMENTATION_NAME = "io.opentelemetry.vibur-dbcp-11.0" ;
28- private static final Duration EXPORTER_INTERVAL = Duration .ofMillis (100 );
2926
3027 @ Mock private DataSource dataSourceMock ;
3128 @ Mock private Connection connectionMock ;
@@ -49,8 +46,6 @@ void shouldReportMetrics() throws SQLException {
4946
5047 // when
5148 Connection viburConnection = viburDataSource .getConnection ();
52- await ().pollDelay (EXPORTER_INTERVAL ).until (() -> true );
53- viburConnection .close ();
5449
5550 // then
5651 DbConnectionPoolMetricsAssertions .create (testing (), INSTRUMENTATION_NAME , "testPool" )
@@ -64,15 +59,14 @@ void shouldReportMetrics() throws SQLException {
6459 .assertConnectionPoolEmitsMetrics ();
6560
6661 // when
62+ viburConnection .close ();
63+
6764 // this one too shouldn't cause any problems when called more than once
6865 viburDataSource .close ();
6966 viburDataSource .close ();
7067 shutdown (viburDataSource );
7168
72- // sleep exporter interval
73- await ().pollDelay (EXPORTER_INTERVAL ).until (() -> true );
7469 testing ().clearData ();
75- await ().pollDelay (EXPORTER_INTERVAL ).until (() -> true );
7670
7771 // then
7872 String countMetricName =
0 commit comments