File tree Expand file tree Collapse file tree
jmx-scraper/src/integrationTest/java/io/opentelemetry/contrib/jmxscraper Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515import org .junit .jupiter .api .AfterAll ;
1616import org .junit .jupiter .api .BeforeAll ;
1717import org .junit .jupiter .api .Test ;
18+ import org .junit .jupiter .api .condition .EnabledIf ;
1819import org .junit .jupiter .api .io .TempDir ;
1920import org .junit .jupiter .params .ParameterizedTest ;
2021import org .junit .jupiter .params .provider .EnumSource ;
2122import org .slf4j .Logger ;
2223import org .slf4j .LoggerFactory ;
24+ import org .testcontainers .DockerClientFactory ;
2325import org .testcontainers .containers .GenericContainer ;
2426import org .testcontainers .containers .Network ;
2527import org .testcontainers .containers .output .Slf4jLogConsumer ;
2931 * JmxConnectionBuilder and relies on containers to minimize the JMX/RMI network complications which
3032 * are not NAT-friendly.
3133 */
34+ @ EnabledIf ("isDockerAvailable" )
3235class JmxConnectionTest {
3336
37+ static boolean isDockerAvailable () {
38+ try {
39+ DockerClientFactory .instance ().client ();
40+ return true ;
41+ } catch (Throwable e ) {
42+ return false ;
43+ }
44+ }
45+
3446 // OTLP endpoint is not used in test mode, but still has to be provided
3547 private static final String DUMMY_OTLP_ENDPOINT = "http://dummy-otlp-endpoint:8080/" ;
3648 private static final String SCRAPER_BASE_IMAGE = "openjdk:8u342-jre-slim" ;
You can’t perform that action at this time.
0 commit comments