Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 1 addition & 31 deletions .github/workflows/build-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ jobs:

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

integration-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

- name: Set up JDK for running Gradle
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
with:
distribution: temurin
java-version: 17

- name: Set up Gradle
uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0
with:
cache-read-only: ${{ inputs.cache-read-only }}

- name: Integration test
run: ./gradlew integrationTest "-PmaxTestRetries=${{ inputs.max-test-retries }}" ${{ inputs.no-build-cache && '--no-build-cache' || '' }}

- name: Build scan
if: ${{ !cancelled() && hashFiles('build-scan.txt') != '' }}
run: cat build-scan.txt

- name: Save integration test results
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: always()
with:
name: integration-test-results
path: jmx-metrics/build/reports/tests/integrationTest

markdown-lint-check:
uses: ./.github/workflows/reusable-markdown-lint.yml

Expand Down
6 changes: 0 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@ To run the tests:
./gradlew test
```

Some modules include integration tests that can be run with:

```bash
./gradlew integrationTest
```

## Snapshot Builds

Snapshot builds of the `main` branch are available from the Sonatype snapshot repository at:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
import java.time.Duration;
import java.util.Collections;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledIf;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.output.Slf4jLogConsumer;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.utility.DockerImageName;
import org.testcontainers.utility.MountableFile;

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

static boolean hasAwsCredentials() {
return System.getenv("AWS_ACCESS_KEY_ID") != null;
}

private static final Logger logger =
LoggerFactory.getLogger(AwsXrayRemoteSamplerIntegrationTest.class);

Expand Down
6 changes: 6 additions & 0 deletions buildSrc/src/main/kotlin/otel.java-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@ testing {
}
}

tasks {
check {
dependsOn(testing.suites)
}
}

fun isJavaVersionAllowed(version: JavaVersion): Boolean {
if (otelJava.minJavaVersionSupported.get() > version) {
return false
Expand Down
6 changes: 5 additions & 1 deletion ibm-mq-metrics/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ testing {
targets {
all {
testTask.configure {
shouldRunAfter(tasks.test)
// Jakarta JMS requires Java 11+
val testJavaVersion: String? by project
if (testJavaVersion == "8") {
enabled = false
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@
import io.opentelemetry.proto.metrics.v1.Metric;
import java.time.Duration;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnJre;
import org.junit.jupiter.api.condition.JRE;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.Network;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.junit.jupiter.Container;

// Java 8 has issues resolving Docker network hostnames (java.net.UnknownHostException)
@DisabledOnJre(JRE.JAVA_8)
class SolrIntegrationTest extends AbstractIntegrationTest {

SolrIntegrationTest() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.Network;
import org.testcontainers.containers.output.Slf4jLogConsumer;
import org.testcontainers.junit.jupiter.Testcontainers;

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

// OTLP endpoint is not used in test mode, but still has to be provided
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@
import io.opentelemetry.contrib.jmxscraper.assertions.AttributeMatcherGroup;
import java.nio.file.Path;
import java.time.Duration;
import org.junit.jupiter.api.condition.DisabledOnJre;
import org.junit.jupiter.api.condition.JRE;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.Network;
import org.testcontainers.containers.wait.strategy.Wait;

// Java 8 has issues resolving Docker network hostnames (java.net.UnknownHostException)
@DisabledOnJre(JRE.JAVA_8)
class SolrIntegrationTest extends TargetSystemIntegrationTest {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import static org.assertj.core.api.Assertions.assertThat;
import static org.awaitility.Awaitility.await;
import static org.testcontainers.Testcontainers.exposeHostPorts;

import com.linecorp.armeria.server.ServerBuilder;
import com.linecorp.armeria.server.grpc.GrpcService;
Expand Down Expand Up @@ -35,11 +36,12 @@
import org.junit.jupiter.api.io.TempDir;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testcontainers.Testcontainers;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.Network;
import org.testcontainers.containers.output.Slf4jLogConsumer;
import org.testcontainers.junit.jupiter.Testcontainers;

@Testcontainers(disabledWithoutDocker = true)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is needed because the Windows runners now run these tests (where only Windows containers are supported)

Copy link
Contributor

@robsunday robsunday Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these tests run on linux then? We need to make sure they run somewhere. Ideally on weekly basis at least.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, they run on linux

public abstract class TargetSystemIntegrationTest {
private static final Logger logger = LoggerFactory.getLogger(TargetSystemIntegrationTest.class);
private static final Logger targetSystemLogger = LoggerFactory.getLogger("TargetSystemContainer");
Expand Down Expand Up @@ -72,7 +74,7 @@ static void beforeAll() {
network = Network.newNetwork();
otlpServer = new OtlpGrpcServer();
otlpServer.start();
Testcontainers.exposeHostPorts(otlpServer.httpPort());
exposeHostPorts(otlpServer.httpPort());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change needed because of conflict with Testcontainers annotation in different package.

otlpEndpoint = "http://" + OTLP_HOST + ":" + otlpServer.httpPort();
}

Expand Down
5 changes: 0 additions & 5 deletions runtime-attach/runtime-attach/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,4 @@ tasks {
excludeTestsMatching("AgentDisabledBySystemPropertyTest")
}
}

check {
dependsOn(testAgentDisabledByEnvironmentVariable)
dependsOn(testAgentDisabledBySystemProperty)
}
}
Loading