Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
28 changes: 19 additions & 9 deletions dd-smoke-tests/jboss-modules/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ apply from: "$rootDir/gradle/java.gradle"
description = 'JBoss Modules Smoke Tests.'

configurations {
jbossModulesV1
jbossModulesV2
register('jbossModulesV1')
register('jbossModulesV2')
}

configurations.matching { name =~ /jbossModules.*/ }.configureEach {
Expand All @@ -30,14 +30,14 @@ dependencies {
}

tasks.register('libraryModules', Copy) {
from configurations.compileClasspath
into libsDirectory.dir('test-repo')
from configurations.named('compileClasspath')
into layout.buildDirectory.dir('test-repo')
exclude '**/jboss-modules-*'
rename '(.*)(-[0-9][^-]*)\\.jar', '$1/main/$1.jar'
}

def packageTestModule(jar, name) {
jar.destinationDirectory = libsDirectory.dir("test-repo/${name}/main")
jar.destinationDirectory = layout.buildDirectory.dir("test-repo/${name}/main")
jar.archiveFileName = "${name}.jar"
jar.from sourceSets.main.output
jar.include "datadog/smoketest/jbossmodules/${name}/**"
Expand Down Expand Up @@ -67,7 +67,7 @@ tasks.register('appModule', Jar) {

tasks.register('moduleDescriptors', Copy) {
from sourceSets.main.output.resourcesDir
into libsDirectory.dir('test-repo')
into layout.buildDirectory.dir('test-repo')
dependsOn "processResources"
}

Expand All @@ -81,7 +81,17 @@ tasks.withType(Test).configureEach {
"subscribingModule",
"appModule"

jvmArgs "-Ddatadog.smoketest.jbossmodules.JBossModulesV1=${configurations.jbossModulesV1.asPath}"
jvmArgs "-Ddatadog.smoketest.jbossmodules.JBossModulesV2=${configurations.jbossModulesV2.asPath}"
jvmArgs "-Ddatadog.smoketest.jbossmodules.repoPath=${libsDirectory.dir('test-repo').get()}"
jvmArgumentProviders.add(new CommandLineArgumentProvider() {
@Override
Iterable<String> asArguments() {
def jbossModulesV1Jar = configurations.named('jbossModulesV1').get().asPath
def jbossModulesV2Jar = configurations.named('jbossModulesV2').get().asPath

return [
"-Ddatadog.smoketest.jbossmodules.JBossModulesV1=${jbossModulesV1Jar}",
"-Ddatadog.smoketest.jbossmodules.JBossModulesV2=${jbossModulesV2Jar}",
"-Ddatadog.smoketest.jbossmodules.repoPath=${layout.buildDirectory.dir('test-repo').get()}"
]
}
})
}
14 changes: 10 additions & 4 deletions dd-smoke-tests/junit-console/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import java.time.Duration
import java.time.temporal.ChronoUnit

apply from: "$rootDir/gradle/java.gradle"
description = 'JUnit Console Smoke Tests.'

Expand All @@ -11,7 +8,16 @@ dependencies {
}

tasks.withType(Test).configureEach {
jvmArgs "-Ddatadog.smoketest.junit.console.jar.path=${configurations.runtimeClasspath.find { it.name.contains('junit-platform-console-standalone') }}"
jvmArgumentProviders.add(new CommandLineArgumentProvider() {
@Override
Iterable<String> asArguments() {
def consoleJarFile = configurations.named("runtimeClasspath")
.get()
.find { it.name.contains("junit-platform-console-standalone") }

return ["-Ddatadog.smoketest.junit.console.jar.path=${consoleJarFile}"]
}
})

if (project.hasProperty("mavenRepositoryProxy")) {
// propagate proxy URL to tests, to then propagate it to nested Gradle builds
Expand Down
83 changes: 52 additions & 31 deletions dd-smoke-tests/osgi/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import aQute.bnd.gradle.Bundle

plugins {
id 'biz.aQute.bnd.builder' version '6.1.0' apply false
id 'biz.aQute.bnd.builder' version '6.1.0' apply true
}

repositories {
Expand All @@ -12,14 +14,12 @@ apply from: "$rootDir/gradle/java.gradle"
description = 'OSGi Application Smoke Tests.'

configurations {
equinox
felix
knopflerfish
bundles
}

configurations.named('bundles') {
transitive = false
register('equinox')
register('felix')
register('knopflerfish')
register('bundles') {
transitive = false
}
}

dependencies {
Expand All @@ -42,13 +42,18 @@ dependencies {
testImplementation project(':dd-smoke-tests')
}

tasks.named("jar", Jar) {
include 'datadog/smoketest/osgi/app/**'
// The bnd builder plugin modifies the jar task to post process it with bnd.
// Since this cannot be disabled, we disable the jar task and create another one.
tasks.named('jar', Jar) {
enabled = false
}

import aQute.bnd.gradle.Bundle
def jarTask = tasks.register("appJar", Jar) {
from sourceSets.main.output
include 'datadog/smoketest/osgi/app/**'
}

tasks.register('commonBundle', Bundle) {
def commonBundle = tasks.register('commonBundle', Bundle) {
archiveClassifier = 'common'
from sourceSets.main.output
include 'datadog/smoketest/osgi/common/**'
Expand All @@ -57,7 +62,7 @@ tasks.register('commonBundle', Bundle) {
}
}

tasks.register('clientBundle', Bundle) {
def clientBundle = tasks.register('clientBundle', Bundle) {
archiveClassifier = 'client'
from sourceSets.main.output
include 'datadog/smoketest/osgi/client/**'
Expand All @@ -66,7 +71,7 @@ tasks.register('clientBundle', Bundle) {
}
}

tasks.register('messagingBundle', Bundle) {
def messagingBundle = tasks.register('messagingBundle', Bundle) {
archiveClassifier = 'messaging'
from sourceSets.main.output
include 'datadog/smoketest/osgi/messaging/**'
Expand All @@ -75,7 +80,7 @@ tasks.register('messagingBundle', Bundle) {
}
}

tasks.register('publishingBundle', Bundle) {
def publishingBundle = tasks.register('publishingBundle', Bundle) {
archiveClassifier = 'publishing'
from sourceSets.main.output
include 'datadog/smoketest/osgi/publishing/**'
Expand All @@ -84,7 +89,7 @@ tasks.register('publishingBundle', Bundle) {
}
}

tasks.register('subscribingBundle', Bundle) {
def subscribingBundle = tasks.register('subscribingBundle', Bundle) {
archiveClassifier = 'subscribing'
from sourceSets.main.output
include 'datadog/smoketest/osgi/subscribing/**'
Expand All @@ -94,18 +99,34 @@ tasks.register('subscribingBundle', Bundle) {
}

tasks.withType(Test).configureEach {
dependsOn "commonBundle", "clientBundle", "messagingBundle", "publishingBundle", "subscribingBundle", "jar"

jvmArgs "-Ddatadog.smoketest.osgi.appJar.path=${tasks.jar.archiveFile.get()}"
jvmArgs "-Ddatadog.smoketest.osgi.equinoxJar.path=${configurations.equinox.first().path}"
jvmArgs "-Ddatadog.smoketest.osgi.felixJar.path=${configurations.felix.first().path}"
jvmArgs "-Ddatadog.smoketest.osgi.knopflerfishJar.path=${configurations.knopflerfish.first().path}"

jvmArgs "-Ddatadog.smoketest.osgi.bundle.paths=" +
"${tasks.commonBundle.archiveFile.get()}," +
"${tasks.clientBundle.archiveFile.get()}," +
"${tasks.messagingBundle.archiveFile.get()}," +
"${tasks.publishingBundle.archiveFile.get()}," +
"${tasks.subscribingBundle.archiveFile.get()}," +
"${configurations.bundles*.path.join(',')}"
dependsOn commonBundle, clientBundle, messagingBundle, publishingBundle, subscribingBundle, jarTask

jvmArgumentProviders.add(new CommandLineArgumentProvider() {
@Override
Iterable<String> asArguments() {
// def jarTask = tasks.named('appJar', Jar).get()
def equinoxJar = configurations.named('equinox').get().first().path
def felixJar = configurations.named('felix').get().first().path
def knopflerfishJar = configurations.named('knopflerfish').get().first().path

def bundlePaths = [
commonBundle.get().archiveFile.get(),
clientBundle.get().archiveFile.get(),
messagingBundle.get().archiveFile.get(),
publishingBundle.get().archiveFile.get(),
subscribingBundle.get().archiveFile.get(),
*configurations.named('bundles').get().collect {
it.path
}
].join(',')

return [
"-Ddatadog.smoketest.osgi.appJar.path=${jarTask.get().archiveFile.get()}",
"-Ddatadog.smoketest.osgi.equinoxJar.path=${equinoxJar}",
"-Ddatadog.smoketest.osgi.felixJar.path=${felixJar}",
"-Ddatadog.smoketest.osgi.knopflerfishJar.path=${knopflerfishJar}",
"-Ddatadog.smoketest.osgi.bundle.paths=${bundlePaths}"
]
}
})
}
8 changes: 7 additions & 1 deletion dd-smoke-tests/spring-security/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ dependencies {


tasks.withType(Test).configureEach {
jvmArgs "-Ddatadog.smoketest.springboot.shadowJar.path=${tasks.jar.archiveFile.get()}"
jvmArgumentProviders.add(new CommandLineArgumentProvider() {
@Override
Iterable<String> asArguments() {
def jarTask = tasks.named('jar', Jar).get()
return ["-Ddatadog.smoketest.springboot.shadowJar.path=${jarTask.archiveFile.get()}"]
}
})
}

tasks.named("processResources", ProcessResources) {
Expand Down
11 changes: 10 additions & 1 deletion dd-smoke-tests/springboot-jetty-jsp/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.springframework.boot.gradle.tasks.bundling.BootWar

plugins {
id 'java'
id 'war'
Expand Down Expand Up @@ -34,5 +36,12 @@ dependencies {

tasks.withType(Test).configureEach {
dependsOn "war", "bootWar"
jvmArgs "-Ddatadog.smoketest.springboot.war.path=${tasks.bootWar.archiveFile.get().getAsFile()}"

jvmArgumentProviders.add(new CommandLineArgumentProvider() {
@Override
Iterable<String> asArguments() {
def bootWarTask = tasks.named('bootWar', BootWar).get()
return ["-Ddatadog.smoketest.springboot.war.path=${bootWarTask.archiveFile.get().getAsFile()}"]
}
})
}
11 changes: 10 additions & 1 deletion dd-smoke-tests/springboot-jpa/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.springframework.boot.gradle.tasks.bundling.BootWar

plugins {
id 'java'
id 'war'
Expand Down Expand Up @@ -27,7 +29,14 @@ dependencies {

tasks.withType(Test).configureEach {
dependsOn "bootWar"
jvmArgs "-Ddatadog.smoketest.springboot.bootWar.path=${tasks.bootWar.archiveFile.get()}"

jvmArgumentProviders.add(new CommandLineArgumentProvider() {
@Override
Iterable<String> asArguments() {
def bootWarTask = tasks.named('bootWar', BootWar).get()
return ["-Ddatadog.smoketest.springboot.bootWar.path=${bootWarTask.archiveFile.get()}"]
}
})
}

tasks.withType(GroovyCompile).configureEach {
Expand Down
11 changes: 10 additions & 1 deletion dd-smoke-tests/springboot-tomcat-jsp/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.springframework.boot.gradle.tasks.bundling.BootWar

plugins {
id 'java'
id 'war'
Expand Down Expand Up @@ -34,5 +36,12 @@ dependencies {

tasks.withType(Test).configureEach {
dependsOn "war", "bootWar"
jvmArgs "-Ddatadog.smoketest.springboot.war.path=${tasks.bootWar.archiveFile.get().getAsFile()}"

jvmArgumentProviders.add(new CommandLineArgumentProvider() {
@Override
Iterable<String> asArguments() {
def bootWarTask = tasks.named('bootWar', BootWar).get()
return ["-Ddatadog.smoketest.springboot.war.path=${bootWarTask.archiveFile.get().getAsFile()}"]
}
})
}
38 changes: 25 additions & 13 deletions dd-smoke-tests/springboot-tomcat/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.springframework.boot.gradle.tasks.bundling.BootWar

plugins {
id 'war'
id 'org.springframework.boot' version '2.5.12'
Expand Down Expand Up @@ -43,19 +45,20 @@ dependencies {

tasks.register("unzip", Copy) {
def zipFileNamePrefix = "tomcat"
def zipPath = project.configurations.serverFile.find {
it.name.startsWith(zipFileNamePrefix)
}
if (zipPath != null) {
def zipFile = file(zipPath)
def outputDir = file("${buildDir}")

from zipTree(zipFile)
into outputDir
} else {
throw new GradleException("Can't find server zip file that starts with: " + zipFileNamePrefix)
def serverZipTree = providers.provider {
// eager access
def zipPath = project.configurations.serverFile.find {
it.name.startsWith(zipFileNamePrefix)
}
if (zipPath == null) {
throw new GradleException("Can't find server zip file that starts with: " + zipFileNamePrefix)
}
zipTree(zipPath)
}

from serverZipTree
into layout.buildDirectory

// When tests are disabled this would still be run, so disable this manually
onlyIf { !project.rootProject.hasProperty("skipTests") }
}
Expand Down Expand Up @@ -109,6 +112,15 @@ tasks.matching({it.name.startsWith('compileTest')}).configureEach {

tasks.withType(Test).configureEach {
dependsOn "war", "bootWar", "unzip"
jvmArgs "-Ddatadog.smoketest.springboot.war.path=${tasks.bootWar.archiveFile.get().getAsFile()}"
jvmArgs "-Ddatadog.smoketest.tomcatDir=${buildDir}/apache-${serverName}-${serverVersion}"

jvmArgumentProviders.add(new CommandLineArgumentProvider() {
@Override
Iterable<String> asArguments() {
def bootWarTask = tasks.named('bootWar', BootWar).get()
return [
"-Ddatadog.smoketest.springboot.war.path=${bootWarTask.archiveFile.get().getAsFile()}",
"-Ddatadog.smoketest.tomcatDir=${layout.buildDirectory.get()}/apache-${serverName}-${serverVersion}"
]
}
})
}
8 changes: 7 additions & 1 deletion dd-smoke-tests/tracer-flare/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,11 @@ dependencies {
tasks.withType(Test).configureEach {
dependsOn "jar"

jvmArgs "-Ddatadog.smoketest.tracer-flare.jar.path=${tasks.jar.archiveFile.get()}"
jvmArgumentProviders.add(new CommandLineArgumentProvider() {
@Override
Iterable<String> asArguments() {
def jarTask = tasks.named('jar', Jar).get()
return ["-Ddatadog.smoketest.tracer-flare.jar.path=${jarTask.archiveFile.get()}"]
}
})
}
Loading