Skip to content

Commit e8e2b89

Browse files
traskotelbot[bot]
andauthored
Ensure all test suites are run (#2344)
Co-authored-by: otelbot <[email protected]>
1 parent deff57e commit e8e2b89

File tree

10 files changed

+34
-47
lines changed

10 files changed

+34
-47
lines changed

.github/workflows/build-common.yml

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ jobs:
111111

112112
- name: Test
113113
run: >
114-
./gradlew test
114+
./gradlew check -x spotlessCheck
115115
"-PtestJavaVersion=${{ matrix.test-java-version }}"
116116
"-Porg.gradle.java.installations.paths=${{ steps.setup-java-test.outputs.path }}"
117117
"-Porg.gradle.java.installations.auto-download=false"
@@ -122,36 +122,6 @@ jobs:
122122
if: ${{ !cancelled() && hashFiles('build-scan.txt') != '' }}
123123
run: cat build-scan.txt
124124

125-
integration-test:
126-
runs-on: ubuntu-latest
127-
steps:
128-
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
129-
130-
- name: Set up JDK for running Gradle
131-
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
132-
with:
133-
distribution: temurin
134-
java-version: 17
135-
136-
- name: Set up Gradle
137-
uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0
138-
with:
139-
cache-read-only: ${{ inputs.cache-read-only }}
140-
141-
- name: Integration test
142-
run: ./gradlew integrationTest "-PmaxTestRetries=${{ inputs.max-test-retries }}" ${{ inputs.no-build-cache && '--no-build-cache' || '' }}
143-
144-
- name: Build scan
145-
if: ${{ !cancelled() && hashFiles('build-scan.txt') != '' }}
146-
run: cat build-scan.txt
147-
148-
- name: Save integration test results
149-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
150-
if: always()
151-
with:
152-
name: integration-test-results
153-
path: jmx-metrics/build/reports/tests/integrationTest
154-
155125
markdown-lint-check:
156126
uses: ./.github/workflows/reusable-markdown-lint.yml
157127

CONTRIBUTING.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,6 @@ To run the tests:
3131
./gradlew test
3232
```
3333

34-
Some modules include integration tests that can be run with:
35-
36-
```bash
37-
./gradlew integrationTest
38-
```
39-
4034
## Snapshot Builds
4135

4236
Snapshot builds of the `main` branch are available from the Sonatype snapshot repository at:

aws-xray/src/awsTest/java/io/opentelemetry/contrib/aws/xray/AwsXrayRemoteSamplerIntegrationTest.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
import java.time.Duration;
1717
import java.util.Collections;
1818
import org.junit.jupiter.api.Test;
19+
import org.junit.jupiter.api.condition.EnabledIf;
1920
import org.slf4j.Logger;
2021
import org.slf4j.LoggerFactory;
2122
import org.testcontainers.containers.GenericContainer;
2223
import org.testcontainers.containers.output.Slf4jLogConsumer;
2324
import org.testcontainers.containers.wait.strategy.Wait;
2425
import org.testcontainers.junit.jupiter.Container;
25-
import org.testcontainers.junit.jupiter.Testcontainers;
2626
import org.testcontainers.utility.DockerImageName;
2727
import org.testcontainers.utility.MountableFile;
2828

@@ -31,9 +31,13 @@
3131
// to update sampling rules and assert rough ratios of sampling decisions. In the meantime, it
3232
// expects you to update the rules through the dashboard to see the effect on the sampling decisions
3333
// that are printed.
34-
@Testcontainers(disabledWithoutDocker = true)
34+
@EnabledIf("hasAwsCredentials")
3535
class AwsXrayRemoteSamplerIntegrationTest {
3636

37+
static boolean hasAwsCredentials() {
38+
return System.getenv("AWS_ACCESS_KEY_ID") != null;
39+
}
40+
3741
private static final Logger logger =
3842
LoggerFactory.getLogger(AwsXrayRemoteSamplerIntegrationTest.class);
3943

buildSrc/src/main/kotlin/otel.java-conventions.gradle.kts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,12 @@ testing {
173173
}
174174
}
175175

176+
tasks {
177+
check {
178+
dependsOn(testing.suites)
179+
}
180+
}
181+
176182
fun isJavaVersionAllowed(version: JavaVersion): Boolean {
177183
if (otelJava.minJavaVersionSupported.get() > version) {
178184
return false

ibm-mq-metrics/build.gradle.kts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@ testing {
5050
targets {
5151
all {
5252
testTask.configure {
53-
shouldRunAfter(tasks.test)
53+
// Jakarta JMS requires Java 11+
54+
val testJavaVersion: String? by project
55+
if (testJavaVersion == "8") {
56+
enabled = false
57+
}
5458
}
5559
}
5660
}

jmx-metrics/src/integrationTest/java/io/opentelemetry/contrib/jmxmetrics/target_systems/SolrIntegrationTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,16 @@
1111
import io.opentelemetry.proto.metrics.v1.Metric;
1212
import java.time.Duration;
1313
import org.junit.jupiter.api.Test;
14+
import org.junit.jupiter.api.condition.DisabledOnJre;
15+
import org.junit.jupiter.api.condition.JRE;
1416
import org.testcontainers.containers.GenericContainer;
1517
import org.testcontainers.containers.Network;
1618
import org.testcontainers.containers.wait.strategy.Wait;
1719
import org.testcontainers.junit.jupiter.Container;
1820

21+
// possible workaround on Java 8:
22+
// https://stackoverflow.com/questions/35466461/how-to-connect-with-jmx-from-host-to-docker-container-in-docker-machine
23+
@DisabledOnJre(JRE.JAVA_8)
1924
class SolrIntegrationTest extends AbstractIntegrationTest {
2025

2126
SolrIntegrationTest() {

jmx-scraper/src/integrationTest/java/io/opentelemetry/contrib/jmxscraper/JmxConnectionTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,14 @@
2323
import org.testcontainers.containers.GenericContainer;
2424
import org.testcontainers.containers.Network;
2525
import org.testcontainers.containers.output.Slf4jLogConsumer;
26+
import org.testcontainers.junit.jupiter.Testcontainers;
2627

2728
/**
2829
* Tests all supported ways to connect to remote JMX interface. This indirectly tests
2930
* JmxConnectionBuilder and relies on containers to minimize the JMX/RMI network complications which
3031
* are not NAT-friendly.
3132
*/
33+
@Testcontainers(disabledWithoutDocker = true)
3234
class JmxConnectionTest {
3335

3436
// OTLP endpoint is not used in test mode, but still has to be provided

jmx-scraper/src/integrationTest/java/io/opentelemetry/contrib/jmxscraper/target_systems/SolrIntegrationTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,15 @@
1414
import io.opentelemetry.contrib.jmxscraper.assertions.AttributeMatcherGroup;
1515
import java.nio.file.Path;
1616
import java.time.Duration;
17+
import org.junit.jupiter.api.condition.DisabledOnJre;
18+
import org.junit.jupiter.api.condition.JRE;
1719
import org.testcontainers.containers.GenericContainer;
1820
import org.testcontainers.containers.Network;
1921
import org.testcontainers.containers.wait.strategy.Wait;
2022

23+
// possible workaround on Java 8:
24+
// https://stackoverflow.com/questions/35466461/how-to-connect-with-jmx-from-host-to-docker-container-in-docker-machine
25+
@DisabledOnJre(JRE.JAVA_8)
2126
class SolrIntegrationTest extends TargetSystemIntegrationTest {
2227

2328
@Override

jmx-scraper/src/integrationTest/java/io/opentelemetry/contrib/jmxscraper/target_systems/TargetSystemIntegrationTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import static org.assertj.core.api.Assertions.assertThat;
99
import static org.awaitility.Awaitility.await;
10+
import static org.testcontainers.Testcontainers.exposeHostPorts;
1011

1112
import com.linecorp.armeria.server.ServerBuilder;
1213
import com.linecorp.armeria.server.grpc.GrpcService;
@@ -35,11 +36,12 @@
3536
import org.junit.jupiter.api.io.TempDir;
3637
import org.slf4j.Logger;
3738
import org.slf4j.LoggerFactory;
38-
import org.testcontainers.Testcontainers;
3939
import org.testcontainers.containers.GenericContainer;
4040
import org.testcontainers.containers.Network;
4141
import org.testcontainers.containers.output.Slf4jLogConsumer;
42+
import org.testcontainers.junit.jupiter.Testcontainers;
4243

44+
@Testcontainers(disabledWithoutDocker = true)
4345
public abstract class TargetSystemIntegrationTest {
4446
private static final Logger logger = LoggerFactory.getLogger(TargetSystemIntegrationTest.class);
4547
private static final Logger targetSystemLogger = LoggerFactory.getLogger("TargetSystemContainer");
@@ -72,7 +74,7 @@ static void beforeAll() {
7274
network = Network.newNetwork();
7375
otlpServer = new OtlpGrpcServer();
7476
otlpServer.start();
75-
Testcontainers.exposeHostPorts(otlpServer.httpPort());
77+
exposeHostPorts(otlpServer.httpPort());
7678
otlpEndpoint = "http://" + OTLP_HOST + ":" + otlpServer.httpPort();
7779
}
7880

runtime-attach/runtime-attach/build.gradle.kts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,4 @@ tasks {
5959
excludeTestsMatching("AgentDisabledBySystemPropertyTest")
6060
}
6161
}
62-
63-
check {
64-
dependsOn(testAgentDisabledByEnvironmentVariable)
65-
dependsOn(testAgentDisabledBySystemProperty)
66-
}
6762
}

0 commit comments

Comments
 (0)