-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
6,490 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionSha256Sum=abc10bcedb58806e8654210f96031db541bcd2d6fc3161e81cb0572d6a15e821 | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
72 changes: 72 additions & 0 deletions
72
...java/org/jboss/gm/manipulation/OpenTelemetryJavaInstrumentationProjectFunctionalTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package org.jboss.gm.manipulation; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.net.URISyntaxException; | ||
|
||
import org.eclipse.jgit.api.Git; | ||
import org.eclipse.jgit.api.errors.GitAPIException; | ||
import org.gradle.testkit.runner.BuildResult; | ||
import org.gradle.testkit.runner.TaskOutcome; | ||
import org.gradle.util.GradleVersion; | ||
import org.jboss.gm.common.JVMTestSetup; | ||
import org.junit.BeforeClass; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.contrib.java.lang.system.RestoreSystemProperties; | ||
import org.junit.contrib.java.lang.system.SystemOutRule; | ||
import org.junit.rules.TemporaryFolder; | ||
import org.junit.rules.TestRule; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.jboss.gm.common.JVMTestSetup.JDK17_DIR; | ||
import static org.junit.Assume.assumeTrue; | ||
|
||
public class OpenTelemetryJavaInstrumentationProjectFunctionalTest { | ||
|
||
@Rule | ||
public final SystemOutRule systemOutRule = new SystemOutRule().enableLog();//.muteForSuccessfulTests(); | ||
|
||
@Rule | ||
public TemporaryFolder tempDir = new TemporaryFolder(); | ||
|
||
@Rule | ||
public final TestRule restoreSystemProperties = new RestoreSystemProperties(); | ||
|
||
@BeforeClass | ||
public static void setupJVM() throws IOException { | ||
JVMTestSetup.setupJVM(); | ||
} | ||
|
||
@Test | ||
public void testOpenTelemetryJavaInstrumentation() throws IOException, URISyntaxException, GitAPIException { | ||
assumeTrue(GradleVersion.current().compareTo(GradleVersion.version("8.0")) >= 0); | ||
|
||
final File opentelemetryProjectRoot = tempDir.newFolder("opentelemetry-java-instrumentation-project"); | ||
|
||
final File publishDirectory = tempDir.newFolder("publish"); | ||
System.setProperty("AProxDeployUrl", "file://" + publishDirectory.toString()); | ||
|
||
try (Git ignored = Git.cloneRepository() | ||
.setURI("https://github.com/open-telemetry/opentelemetry-java-instrumentation.git") | ||
.setDirectory(opentelemetryProjectRoot) | ||
.setBranch("refs/tags/v2.5.0") | ||
.setDepth(1) | ||
.call()) { | ||
System.out.println("Cloned opentelemetry-java-instrumentation to " + opentelemetryProjectRoot); | ||
} | ||
|
||
TestUtils.copyDirectory("opentelemetry-java-instrumentation", opentelemetryProjectRoot); | ||
|
||
final BuildResult buildResult = TestUtils.createGradleRunner() | ||
.withProjectDir(opentelemetryProjectRoot) | ||
.withArguments("-Potel.stable=true", "-Dorg.gradle.java.home=" + JDK17_DIR, "publish", "-x", "test") | ||
.forwardOutput() | ||
.withDebug(false) | ||
.withPluginClasspath() | ||
.build(); | ||
|
||
assertThat(buildResult.task(":bom:publish").getOutcome()).isEqualTo(TaskOutcome.SUCCESS); | ||
assertThat(new File(publishDirectory, "io/opentelemetry/javaagent/opentelemetry-javaagent/2.5.0.redhat-00001/opentelemetry-javaagent-2.5.0.redhat-00001.jar")).exists(); | ||
} | ||
} |
94 changes: 94 additions & 0 deletions
94
manipulation/src/functTest/resources/opentelemetry-java-instrumentation/build.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
|
||
import java.time.Duration | ||
|
||
plugins { | ||
// including this plugin directly instead of by an init script, which allows to use the freshly build version | ||
id("org.jboss.gm.manipulation") | ||
|
||
id("idea") | ||
|
||
id("otel.spotless-conventions") | ||
/* workaround for | ||
What went wrong: | ||
Could not determine the dependencies of task ':smoke-tests-otel-starter:spring-boot-3.2:bootJar'. | ||
> Could not create task ':smoke-tests-otel-starter:spring-boot-3.2:collectReachabilityMetadata'. | ||
> Cannot set the value of task ':smoke-tests-otel-starter:spring-boot-3.2:collectReachabilityMetadata' property 'metadataService' of type org.graalvm.buildtools.gradle.internal.GraalVMReachabilityMetadataService using a provider of type org.graalvm.buildtools.gradle.internal.GraalVMReachabilityMetadataService. | ||
See https://github.com/gradle/gradle/issues/17559#issuecomment-1327991512 | ||
*/ | ||
id("org.graalvm.buildtools.native") apply false | ||
} | ||
|
||
allprojects { | ||
apply(plugin="org.jboss.gm.manipulation") | ||
} | ||
|
||
apply(from = "version.gradle.kts") | ||
|
||
description = "OpenTelemetry instrumentations for Java" | ||
|
||
if (project.findProperty("skipTests") as String? == "true") { | ||
subprojects { | ||
tasks.withType<Test>().configureEach { | ||
enabled = false | ||
} | ||
} | ||
} | ||
|
||
tasks { | ||
val listTestsInPartition by registering { | ||
group = "Help" | ||
description = "List test tasks in given partition" | ||
|
||
// total of 4 partitions (see modulo 4 below) | ||
var testPartition = (project.findProperty("testPartition") as String?)?.toInt() | ||
if (testPartition == null) { | ||
throw GradleException("Test partition must be specified") | ||
} else if (testPartition < 0 || testPartition >= 4) { | ||
throw GradleException("Invalid test partition") | ||
} | ||
|
||
val partitionTasks = ArrayList<Test>() | ||
var testPartitionCounter = 0 | ||
subprojects { | ||
// relying on predictable ordering of subprojects | ||
// (see https://docs.gradle.org/current/dsl/org.gradle.api.Project.html#N14CB4) | ||
// since we are splitting these tasks across different github action jobs | ||
val enabled = testPartitionCounter++ % 4 == testPartition | ||
if (enabled) { | ||
tasks.withType<Test>().configureEach { | ||
partitionTasks.add(this) | ||
} | ||
} | ||
} | ||
|
||
doLast { | ||
File("test-tasks.txt").printWriter().use { writer -> | ||
partitionTasks.forEach { task -> | ||
var taskPath = task.project.path + ":" + task.name | ||
// smoke tests are run separately | ||
// :instrumentation:test runs all instrumentation tests | ||
if (taskPath != ":smoke-tests:test" && taskPath != ":instrumentation:test") { | ||
writer.println(taskPath) | ||
} | ||
} | ||
} | ||
} | ||
|
||
// disable all tasks to stop build | ||
subprojects { | ||
tasks.configureEach { | ||
enabled = false | ||
} | ||
} | ||
} | ||
} | ||
|
||
if (gradle.startParameter.taskNames.any { it.equals("listTestsInPartition") }) { | ||
// disable all tasks to stop build | ||
project.tasks.configureEach { | ||
if (this.name != "listTestsInPartition") { | ||
enabled = false | ||
} | ||
} | ||
} |
Oops, something went wrong.