Improved smoke tests (#934)
* Preping smoke tests * Improved smoke tests * Make it work in Linux * Add workflow to run tests on PR * Build Smoke tests * Fix PR workflow trigger * Fix smoke test apps trigger * Disable smoke tests in CircleCI and let them run in Github Actions only * Fix smoke test apps docker image names * Polish
This commit is contained in:
parent
c4a494cd68
commit
a222676a3e
|
@ -96,7 +96,7 @@ jobs:
|
|||
name: Run Tests
|
||||
command: >-
|
||||
GRADLE_OPTS="-Dotel.forkedMaxHeapSize=4G -Dotel.forkedMinHeapSize=64M"
|
||||
./gradlew <<# parameters.prefixTestTask>>testJava<</ parameters.prefixTestTask>><< parameters.testTask >>
|
||||
./gradlew <<# parameters.prefixTestTask>>testJava<</ parameters.prefixTestTask>><< parameters.testTask >> -x :smoke-tests:test
|
||||
<< pipeline.parameters.gradle_flags >>
|
||||
--max-workers=6
|
||||
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
name: Build Play smoke test distribution
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'smoke-tests/play/**'
|
||||
- '.github/workflows/build-play-smoke-dist.yaml'
|
||||
branches: 'master'
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK 11 for running Gradle
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 11
|
||||
|
||||
- name: Cache gradle dependencies
|
||||
uses: burrunan/gradle-cache-action@v1
|
||||
with:
|
||||
job-id: jdk11
|
||||
|
||||
- name: Login to GitHub Package Registry
|
||||
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login docker.pkg.github.com -u ${{ github.repository }} --password-stdin
|
||||
|
||||
- name: Build Docker Image
|
||||
run: cd smoke-tests/play && ./gradlew jib
|
|
@ -0,0 +1,29 @@
|
|||
name: Build Spring Boot smoke test distribution
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'smoke-tests/springboot/**'
|
||||
- '.github/workflows/build-springboot-smoke-dist.yaml'
|
||||
branches: 'master'
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK 11 for running Gradle
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 11
|
||||
|
||||
- name: Cache gradle dependencies
|
||||
uses: burrunan/gradle-cache-action@v1
|
||||
with:
|
||||
job-id: jdk11
|
||||
|
||||
- name: Login to GitHub Package Registry
|
||||
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login docker.pkg.github.com -u ${{ github.repository }} --password-stdin
|
||||
|
||||
- name: Build Docker Image
|
||||
run: cd smoke-tests/springboot && ./gradlew jib
|
|
@ -0,0 +1,37 @@
|
|||
name: PR build
|
||||
|
||||
on: pull_request
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
java: [8, 11, 14]
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK ${{ matrix.java }} for running tests
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: ${{ matrix.java }}
|
||||
- name: Set JDK ${{ matrix.java }} home
|
||||
run: echo "::set-env name=JAVA_${{ matrix.java }}_HOME::${{ env.JAVA_HOME }}"
|
||||
|
||||
- name: Set up JDK 11 for running Gradle
|
||||
if: matrix.java != 11
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 11
|
||||
|
||||
- name: Cache gradle dependencies
|
||||
uses: burrunan/gradle-cache-action@v1
|
||||
with:
|
||||
job-id: jdk${{ matrix.java }}
|
||||
|
||||
- name: Test with Gradle
|
||||
uses: nick-invision/retry@v1
|
||||
with:
|
||||
command: ./gradlew testJava${{ matrix.java }} --stacktrace
|
||||
timeout_minutes: 60
|
||||
max_attempts: 3
|
|
@ -57,4 +57,8 @@ derby.log
|
|||
hs_err_pid*
|
||||
replay_pid*
|
||||
|
||||
!java-agent/benchmark/releases/*.jar
|
||||
!java-agent/benchmark/releases/*.jar
|
||||
/smoke-tests/play/.gradle/
|
||||
/smoke-tests/play/.idea/
|
||||
/smoke-tests/springboot/.gradle/
|
||||
/smoke-tests/springboot/.idea/
|
||||
|
|
|
@ -39,6 +39,7 @@ ext {
|
|||
opentelemetryOtlp : dependencies.create(group: 'io.opentelemetry', name: 'opentelemetry-exporters-otlp', version: versions.opentelemetryOther),
|
||||
opentelemetryZipkin : dependencies.create(group: 'io.opentelemetry', name: 'opentelemetry-exporters-zipkin', version: versions.opentelemetryOther),
|
||||
opentelemetryLogging : dependencies.create(group: 'io.opentelemetry', name: 'opentelemetry-exporters-logging', version: versions.opentelemetryOther),
|
||||
opentelemetryProto : dependencies.create(group: 'io.opentelemetry', name: 'opentelemetry-proto', version: versions.opentelemetryOther),
|
||||
|
||||
// General
|
||||
slf4j : "org.slf4j:slf4j-api:${versions.slf4j}",
|
||||
|
|
|
@ -37,12 +37,7 @@ include ':utils:test-utils'
|
|||
include ':utils:thread-utils'
|
||||
|
||||
// smoke tests
|
||||
include ':smoke-tests:cli'
|
||||
include ':smoke-tests:java9-modules'
|
||||
include ':smoke-tests:play'
|
||||
include ':smoke-tests:springboot'
|
||||
include ':smoke-tests:wildfly'
|
||||
include ':smoke-tests:springboot'
|
||||
include ':smoke-tests'
|
||||
|
||||
// instrumentation:
|
||||
include ':instrumentation:akka-context-propagation'
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
plugins {
|
||||
id "com.github.johnrengelman.shadow"
|
||||
}
|
||||
apply from: "$rootDir/gradle/java.gradle"
|
||||
description = 'Command Line Application Smoke Tests.'
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes(
|
||||
'Main-Class': 'io.opentelemetry.smoketest.cli.CliApplication'
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation deps.opentelemetryApi
|
||||
|
||||
testImplementation project(':smoke-tests')
|
||||
}
|
||||
|
||||
tasks.withType(Test).configureEach {
|
||||
dependsOn shadowJar
|
||||
|
||||
jvmArgs "-Dio.opentelemetry.smoketest.cli.shadowJar.path=${tasks.shadowJar.archivePath}"
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.opentelemetry.smoketest.cli;
|
||||
|
||||
import static io.opentelemetry.trace.TracingContextUtils.currentContextWith;
|
||||
|
||||
import io.opentelemetry.OpenTelemetry;
|
||||
import io.opentelemetry.context.Scope;
|
||||
import io.opentelemetry.trace.Span;
|
||||
import io.opentelemetry.trace.Tracer;
|
||||
|
||||
/** Simple application that sleeps then quits. */
|
||||
public class CliApplication {
|
||||
|
||||
private static final Tracer TRACER =
|
||||
OpenTelemetry.getTracerProvider().get("io.opentelemetry.auto");
|
||||
|
||||
public static void main(final String[] args) throws InterruptedException {
|
||||
CliApplication app = new CliApplication();
|
||||
|
||||
// Sleep to ensure all of the processes are running
|
||||
Thread.sleep(5000);
|
||||
|
||||
System.out.println("Calling example trace");
|
||||
|
||||
app.exampleTrace();
|
||||
|
||||
System.out.println("Finished calling example trace");
|
||||
}
|
||||
|
||||
public void exampleTrace() throws InterruptedException {
|
||||
Span span = TRACER.spanBuilder("example").startSpan();
|
||||
try (Scope scope = currentContextWith(span)) {
|
||||
Thread.sleep(500);
|
||||
span.end();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.opentelemetry.smoketest
|
||||
|
||||
import spock.lang.Timeout
|
||||
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
class CliApplicationSmokeTest extends AbstractSmokeTest {
|
||||
// Estimate for the amount of time instrumentation, plus request, plus some extra
|
||||
private static final int TIMEOUT_SECS = 30
|
||||
|
||||
@Override
|
||||
ProcessBuilder createProcessBuilder() {
|
||||
String cliShadowJar = System.getProperty("io.opentelemetry.smoketest.cli.shadowJar.path")
|
||||
|
||||
List<String> command = new ArrayList<>()
|
||||
command.add(javaPath())
|
||||
command.addAll(defaultJavaProperties)
|
||||
command.addAll((String[]) ["-jar", cliShadowJar])
|
||||
ProcessBuilder processBuilder = new ProcessBuilder(command)
|
||||
processBuilder.directory(new File(buildDirectory))
|
||||
}
|
||||
|
||||
// TODO: once java7 support is dropped use waitFor() with timeout call added in java8
|
||||
// instead of timeout on test
|
||||
@Timeout(value = TIMEOUT_SECS, unit = TimeUnit.SECONDS)
|
||||
def "Cli application process ends before timeout"() {
|
||||
expect:
|
||||
assert testedProcess.waitFor() == 0
|
||||
}
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
ext {
|
||||
minJavaVersionForTests = JavaVersion.VERSION_1_9
|
||||
}
|
||||
|
||||
apply from: "$rootDir/gradle/java.gradle"
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes(
|
||||
'Main-Class': 'io.opentelemetry.smoketest.moduleapp.ModuleApplication'
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
//This test will be automatically disabled by `java.gradle` if tried to run on java earlier than 9
|
||||
test {
|
||||
doFirst {
|
||||
def specificJDKHome = file(executable).parentFile.parent
|
||||
def jlinkExecutable = specificJDKHome + "/bin/jlink"
|
||||
def jdkModulesPath = specificJDKHome + "/jmods"
|
||||
def generatedImageDir = "${buildDir}/${it.name}image"
|
||||
|
||||
delete generatedImageDir
|
||||
|
||||
// Run the jlink command to create the image
|
||||
exec {
|
||||
commandLine jlinkExecutable, '--no-man-pages', '--no-header-files',
|
||||
'--add-modules', 'java.instrument,io.opentelemetry.smoketest.moduleapp',
|
||||
"--module-path", "${jdkModulesPath}:" + jar.archiveFile.get().toString(), "--output", generatedImageDir
|
||||
}
|
||||
|
||||
jvmArgs "-Dio.opentelemetry.smoketest.module.image=${generatedImageDir}"
|
||||
}
|
||||
dependsOn jar
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testImplementation project(':smoke-tests')
|
||||
}
|
||||
|
||||
javadoc.enabled = false
|
|
@ -1,23 +0,0 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.opentelemetry.smoketest.moduleapp;
|
||||
|
||||
public class ModuleApplication {
|
||||
public static void main(final String[] args) throws InterruptedException {
|
||||
Thread.sleep(600);
|
||||
}
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
module io.opentelemetry.smoketest.moduleapp {
|
||||
exports io.opentelemetry.smoketest.moduleapp;
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.opentelemetry.smoketest
|
||||
|
||||
import spock.lang.Timeout
|
||||
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
class Java9ModulesSmokeTest extends AbstractSmokeTest {
|
||||
// Estimate for the amount of time instrumentation plus some extra
|
||||
private static final int TIMEOUT_SECS = 30
|
||||
|
||||
@Override
|
||||
ProcessBuilder createProcessBuilder() {
|
||||
String imageDir = System.getProperty("io.opentelemetry.smoketest.module.image")
|
||||
|
||||
assert imageDir != null
|
||||
|
||||
List<String> command = new ArrayList<>()
|
||||
command.add(imageDir + "/bin/java")
|
||||
command.addAll(defaultJavaProperties)
|
||||
command.addAll((String[]) ["-m", "io.opentelemetry.smoketest.moduleapp/io.opentelemetry.smoketest.moduleapp.ModuleApplication"])
|
||||
ProcessBuilder processBuilder = new ProcessBuilder(command)
|
||||
processBuilder.directory(new File(buildDirectory))
|
||||
}
|
||||
|
||||
// TODO: once java7 support is dropped use waitFor() with timeout call added in java8
|
||||
// instead of timeout on test
|
||||
@Timeout(value = TIMEOUT_SECS, unit = TimeUnit.SECONDS)
|
||||
def "Module application runs correctly"() {
|
||||
expect:
|
||||
assert testedProcess.waitFor() == 0
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
# Play framework smoke test
|
||||
Play application used by smoke tests of OpenTelemetry java agent.
|
||||
Builds and publishes Docker image containing a trivial Play application.
|
||||
|
||||
This is a separate gradle project, independent from the rest. This was done to allow
|
||||
to build and publish it only when actually needed and not on every project build.
|
|
@ -1,9 +1,9 @@
|
|||
plugins {
|
||||
id "org.gradle.playframework" version "0.9"
|
||||
id 'com.google.cloud.tools.jib' version '2.4.0'
|
||||
}
|
||||
|
||||
ext {
|
||||
minJavaVersionForTests = JavaVersion.VERSION_1_8
|
||||
playVersion = "2.6.20"
|
||||
scalaVersion = System.getProperty("scala.binary.version", /* default = */ "2.12")
|
||||
}
|
||||
|
@ -25,25 +25,18 @@ repositories {
|
|||
name "lightbend-maven-releases"
|
||||
url "https://repo.lightbend.com/lightbend/maven-release"
|
||||
}
|
||||
ivy {
|
||||
name "lightbend-ivy-release"
|
||||
url "https://repo.lightbend.com/lightbend/ivy-releases"
|
||||
layout "ivy"
|
||||
}
|
||||
}
|
||||
|
||||
apply from: "$rootDir/gradle/java.gradle"
|
||||
|
||||
description = 'Play Integration Tests.'
|
||||
|
||||
dependencies {
|
||||
implementation "com.typesafe.play:play-guice_$scalaVersion:$playVersion"
|
||||
implementation "com.typesafe.play:play-logback_$scalaVersion:$playVersion"
|
||||
implementation "com.typesafe.play:filters-helpers_$scalaVersion:$playVersion"
|
||||
|
||||
testImplementation project(':smoke-tests')
|
||||
}
|
||||
|
||||
tasks.withType(Test).configureEach {
|
||||
dependsOn 'stage'
|
||||
}
|
||||
jib {
|
||||
from.image = "bellsoft/liberica-openjdk-alpine:11"
|
||||
to.image = "docker.pkg.github.com/open-telemetry/opentelemetry-java-instrumentation/smoke-play"
|
||||
container.mainClass = "play.core.server.ProdServerStart"
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1,5 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
|
@ -0,0 +1,185 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
exec "$JAVACMD" "$@"
|
|
@ -0,0 +1,104 @@
|
|||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
|
@ -0,0 +1 @@
|
|||
rootProject.name = 'play'
|
|
@ -8,18 +8,16 @@ dependencies {
|
|||
|
||||
implementation project(':auto-exporters:opentelemetry-auto-exporter-logging')
|
||||
implementation deps.slf4j
|
||||
implementation deps.opentelemetryProto
|
||||
implementation "org.testcontainers:testcontainers:1.14.3"
|
||||
implementation 'com.google.protobuf:protobuf-java-util:3.12.4'
|
||||
}
|
||||
|
||||
subprojects { subProject ->
|
||||
subProject.tasks.withType(Javadoc).configureEach { enabled = false }
|
||||
subProject.tasks.withType(Test).configureEach {
|
||||
dependsOn = [':opentelemetry-javaagent:shadowJar', ':auto-exporters:opentelemetry-auto-exporter-logging:shadowJar']
|
||||
test {
|
||||
dependsOn = [':opentelemetry-javaagent:shadowJar', ':auto-exporters:opentelemetry-auto-exporter-logging:shadowJar']
|
||||
|
||||
doFirst {
|
||||
// Tests depend on this to know where to run things and what agent jar to use
|
||||
jvmArgs "-Dio.opentelemetry.smoketest.builddir=${buildDir}"
|
||||
jvmArgs "-Dio.opentelemetry.smoketest.agent.shadowJar.path=${project(':opentelemetry-javaagent').tasks.shadowJar.archivePath}"
|
||||
jvmArgs "-Dotel.exporter.jar=${project(':auto-exporters:opentelemetry-auto-exporter-logging').tasks.shadowJar.archivePath}"
|
||||
}
|
||||
doFirst {
|
||||
jvmArgs "-Dio.opentelemetry.smoketest.agent.shadowJar.path=${project(':opentelemetry-javaagent').tasks.shadowJar.archivePath}"
|
||||
jvmArgs "-Dotel.exporter.jar=${project(':auto-exporters:opentelemetry-auto-exporter-logging').tasks.shadowJar.archivePath}"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
# Spring Boot smoke test
|
||||
Spring Boot application used by smoke tests of OpenTelemetry java agent.
|
||||
Builds and publishes Docker image containing a trivial Spring MVC application.
|
||||
|
||||
This is a separate gradle project, independent from the rest. This was done to allow
|
||||
to build and publish it only when actually needed and not on every project build.
|
|
@ -0,0 +1,23 @@
|
|||
plugins {
|
||||
id 'org.springframework.boot' version '2.3.2.RELEASE'
|
||||
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
|
||||
id 'java'
|
||||
id 'com.google.cloud.tools.jib' version '2.4.0'
|
||||
}
|
||||
|
||||
group = 'io.opentelemetry'
|
||||
version = '0.0.1-SNAPSHOT'
|
||||
sourceCompatibility = '8'
|
||||
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'org.springframework.boot:spring-boot-starter-web'
|
||||
}
|
||||
|
||||
jib {
|
||||
from.image = "bellsoft/liberica-openjdk-alpine:11"
|
||||
to.image = "docker.pkg.github.com/open-telemetry/opentelemetry-java-instrumentation/smoke-springboot"
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1,5 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
|
@ -0,0 +1,185 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
exec "$JAVACMD" "$@"
|
|
@ -0,0 +1,104 @@
|
|||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
|
@ -0,0 +1 @@
|
|||
rootProject.name = 'springboot'
|
|
@ -1,28 +0,0 @@
|
|||
plugins {
|
||||
id "com.github.johnrengelman.shadow"
|
||||
}
|
||||
apply from: "$rootDir/gradle/java.gradle"
|
||||
description = 'SpringBoot Smoke Tests.'
|
||||
|
||||
// The standard spring-boot plugin doesn't play nice with our project
|
||||
// so we'll build a fat jar instead
|
||||
jar {
|
||||
manifest {
|
||||
attributes(
|
||||
'Main-Class': 'io.opentelemetry.smoketest.springboot.SpringbootApplication'
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '1.5.18.RELEASE'
|
||||
implementation deps.opentelemetryAutoAnnotations
|
||||
|
||||
testImplementation project(':smoke-tests')
|
||||
}
|
||||
|
||||
tasks.withType(Test).configureEach {
|
||||
dependsOn shadowJar
|
||||
|
||||
jvmArgs "-Dio.opentelemetry.smoketest.springboot.shadowJar.path=${tasks.shadowJar.archivePath}"
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.opentelemetry.smoketest
|
||||
|
||||
import io.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest
|
||||
import okhttp3.Request
|
||||
|
||||
class PlaySmokeTest extends SmokeTest {
|
||||
|
||||
protected String getTargetImage() {
|
||||
"docker.pkg.github.com/open-telemetry/opentelemetry-java-instrumentation/smoke-play:latest"
|
||||
}
|
||||
|
||||
def "play smoke test"() {
|
||||
setup:
|
||||
String url = "http://localhost:${target.getMappedPort(8080)}/welcome?id=1"
|
||||
def request = new Request.Builder().url(url).get().build()
|
||||
|
||||
when:
|
||||
def response = client.newCall(request).execute()
|
||||
Collection<ExportTraceServiceRequest> traces = waitForTraces()
|
||||
|
||||
then:
|
||||
response.body().string() == "Welcome 1."
|
||||
//Both play and akka-http support produce spans with the same name.
|
||||
//One internal, one SERVER
|
||||
countSpansByName(traces, 'GET /welcome') == 2
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,142 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.opentelemetry.smoketest
|
||||
|
||||
import com.google.protobuf.util.JsonFormat
|
||||
import io.opentelemetry.auto.test.utils.OkHttpUtils
|
||||
import io.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest
|
||||
import io.opentelemetry.proto.trace.v1.Span
|
||||
import java.nio.file.Files
|
||||
import java.util.concurrent.TimeUnit
|
||||
import java.util.stream.Stream
|
||||
import okhttp3.OkHttpClient
|
||||
import org.slf4j.Logger
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.testcontainers.containers.GenericContainer
|
||||
import org.testcontainers.containers.Network
|
||||
import org.testcontainers.containers.output.Slf4jLogConsumer
|
||||
import org.testcontainers.utility.MountableFile
|
||||
import spock.lang.Shared
|
||||
import spock.lang.Specification
|
||||
|
||||
abstract class SmokeTest extends Specification {
|
||||
private static final Logger logger = LoggerFactory.getLogger(SmokeTest)
|
||||
|
||||
protected static OkHttpClient client = OkHttpUtils.client()
|
||||
|
||||
@Shared
|
||||
private Network network = Network.newNetwork()
|
||||
@Shared
|
||||
protected String agentPath = System.getProperty("io.opentelemetry.smoketest.agent.shadowJar.path")
|
||||
|
||||
@Shared
|
||||
protected GenericContainer target = new GenericContainer<>(getTargetImage())
|
||||
.withExposedPorts(8080)
|
||||
.withNetwork(network)
|
||||
.withLogConsumer(new Slf4jLogConsumer(logger))
|
||||
.withCopyFileToContainer(MountableFile.forHostPath(agentPath), "/opentelemetry-javaagent-all.jar")
|
||||
.withEnv("JAVA_TOOL_OPTIONS", "-javaagent:/opentelemetry-javaagent-all.jar")
|
||||
.withEnv("OTEL_BSP_MAX_EXPORT_BATCH", "1")
|
||||
.withEnv("OTEL_BSP_SCHEDULE_DELAY", "10")
|
||||
.withEnv("OTEL_OTLP_ENDPOINT", "collector:55680")
|
||||
.withEnv(extraEnv)
|
||||
|
||||
protected abstract String getTargetImage()
|
||||
|
||||
/**
|
||||
* Subclasses can override this method to customise target application's environment
|
||||
*/
|
||||
protected Map<String, String> getExtraEnv() {
|
||||
return Collections.emptyMap()
|
||||
}
|
||||
|
||||
@Shared
|
||||
protected GenericContainer collector = new GenericContainer<>("otel/opentelemetry-collector-dev")
|
||||
.withNetwork(network)
|
||||
.withNetworkAliases("collector")
|
||||
.withLogConsumer(new Slf4jLogConsumer(logger))
|
||||
.withCopyFileToContainer(MountableFile.forClasspathResource("/otel.yaml"), "/etc/otel.yaml")
|
||||
.withCommand("--config /etc/otel.yaml")
|
||||
|
||||
def setupSpec() {
|
||||
collector.start()
|
||||
target.start()
|
||||
}
|
||||
|
||||
def cleanupSpec() {
|
||||
target.stop()
|
||||
collector.stop()
|
||||
}
|
||||
|
||||
protected static int countSpansByName(Collection<ExportTraceServiceRequest> traces, String spanName) {
|
||||
return getSpanStream(traces).filter { it.name == spanName }.count()
|
||||
}
|
||||
|
||||
protected static Stream<Span> getSpanStream(Collection<ExportTraceServiceRequest> traces) {
|
||||
return traces.stream()
|
||||
.flatMap { it.getResourceSpansList().stream() }
|
||||
.flatMap { it.getInstrumentationLibrarySpansList().stream() }
|
||||
.flatMap { it.getSpansList().stream() }
|
||||
}
|
||||
|
||||
protected Collection<ExportTraceServiceRequest> waitForTraces() {
|
||||
def file = new FileInDocker(collector, "/traces.json")
|
||||
waitForFileSizeToStabilize(file)
|
||||
|
||||
return file.readLines().collect {
|
||||
def builder = ExportTraceServiceRequest.newBuilder()
|
||||
JsonFormat.parser().merge(it, builder)
|
||||
return builder.build()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void waitForFileSizeToStabilize(FileInDocker file) {
|
||||
long previousSize = 0
|
||||
long deadline = System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(30)
|
||||
while ((previousSize == 0) || previousSize != file.getSize() && System.currentTimeMillis() < deadline) {
|
||||
previousSize = file.getSize()
|
||||
println "Curent file size $previousSize"
|
||||
TimeUnit.MILLISECONDS.sleep(500)
|
||||
}
|
||||
}
|
||||
|
||||
private static class FileInDocker {
|
||||
private final GenericContainer collector
|
||||
private final File localFile
|
||||
private final String pathInDocker
|
||||
|
||||
FileInDocker(GenericContainer collector, String pathInDocker) {
|
||||
this.pathInDocker = pathInDocker
|
||||
this.collector = collector
|
||||
|
||||
this.localFile = Files.createTempFile("traces", ".json").toFile()
|
||||
localFile.deleteOnExit()
|
||||
println localFile
|
||||
}
|
||||
|
||||
long getSize() {
|
||||
collector.copyFileFromContainer(pathInDocker, localFile.absolutePath)
|
||||
return localFile.size()
|
||||
}
|
||||
|
||||
List<String> readLines() {
|
||||
collector.copyFileFromContainer(pathInDocker, localFile.absolutePath)
|
||||
return localFile.readLines()
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.opentelemetry.smoketest
|
||||
|
||||
import io.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest
|
||||
import okhttp3.Request
|
||||
|
||||
class SpringBootSmokeTest extends SmokeTest {
|
||||
|
||||
protected String getTargetImage() {
|
||||
"docker.pkg.github.com/open-telemetry/opentelemetry-java-instrumentation/smoke-springboot:latest"
|
||||
}
|
||||
|
||||
def "spring boot smoke test"() {
|
||||
setup:
|
||||
String url = "http://localhost:${target.getMappedPort(8080)}/greeting"
|
||||
def request = new Request.Builder().url(url).get().build()
|
||||
|
||||
when:
|
||||
def response = client.newCall(request).execute()
|
||||
Collection<ExportTraceServiceRequest> traces = waitForTraces()
|
||||
|
||||
then:
|
||||
response.body().string() == "Sup Dawg"
|
||||
countSpansByName(traces, '/greeting') == 1
|
||||
countSpansByName(traces, 'WebController.greeting') == 1
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.opentelemetry.smoketest
|
||||
|
||||
import io.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest
|
||||
import okhttp3.Request
|
||||
|
||||
class SpringBootWithSamplingSmokeTest extends SmokeTest {
|
||||
|
||||
static final double SAMPLER_PROBABILITY = 0.2
|
||||
static final int NUM_TRIES = 1000
|
||||
static final int ALLOWED_DEVIATION = 0.1 * NUM_TRIES
|
||||
|
||||
protected String getTargetImage() {
|
||||
"docker.pkg.github.com/open-telemetry/opentelemetry-java-instrumentation/smoke-springboot:latest"
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, String> getExtraEnv() {
|
||||
return ["OTEL_CONFIG_SAMPLER_PROBABILITY": String.valueOf(SAMPLER_PROBABILITY)]
|
||||
}
|
||||
|
||||
def "default home page with probability sampling enabled"() {
|
||||
setup:
|
||||
String url = "http://localhost:${target.getMappedPort(8080)}/greeting"
|
||||
def request = new Request.Builder().url(url).get().build()
|
||||
|
||||
when:
|
||||
for (int i = 1; i <= NUM_TRIES; i++) {
|
||||
client.newCall(request).execute()
|
||||
}
|
||||
Collection<ExportTraceServiceRequest> traces = waitForTraces()
|
||||
|
||||
then:
|
||||
// since sampling is enabled, not really expecting to receive NUM_TRIES spans
|
||||
Math.abs(countSpansByName(traces, 'WebController.greeting') - (SAMPLER_PROBABILITY * NUM_TRIES)) <= ALLOWED_DEVIATION
|
||||
Math.abs(countSpansByName(traces, '/greeting') - (SAMPLER_PROBABILITY * NUM_TRIES)) <= ALLOWED_DEVIATION
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.opentelemetry.smoketest
|
||||
|
||||
|
||||
import okhttp3.Request
|
||||
|
||||
class WildflySmokeTest extends SmokeTest {
|
||||
|
||||
protected String getTargetImage() {
|
||||
"jboss/wildfly:latest"
|
||||
}
|
||||
|
||||
//We don't have support for Wildfly Undertow server yet.
|
||||
//So this test just verifies that Wildfly has come up.
|
||||
def "wildfly smoke test"() {
|
||||
setup:
|
||||
String url = "http://localhost:${target.getMappedPort(8080)}"
|
||||
def request = new Request.Builder().url(url).get().build()
|
||||
|
||||
when:
|
||||
def response = client.newCall(request).execute()
|
||||
|
||||
then:
|
||||
def responseBodyStr = response.body().string()
|
||||
responseBodyStr != null
|
||||
responseBodyStr.contains("Your WildFly instance is running.")
|
||||
response.body().contentType().toString().contains("text/html")
|
||||
response.code() == 200
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
extensions:
|
||||
health_check:
|
||||
pprof:
|
||||
endpoint: 0.0.0.0:1777
|
||||
zpages:
|
||||
endpoint: 0.0.0.0:55679
|
||||
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
grpc:
|
||||
|
||||
processors:
|
||||
batch:
|
||||
queued_retry:
|
||||
|
||||
exporters:
|
||||
logging:
|
||||
loglevel: debug
|
||||
file:
|
||||
path: /traces.json
|
||||
|
||||
service:
|
||||
pipelines:
|
||||
traces:
|
||||
receivers: [otlp]
|
||||
processors: [batch, queued_retry]
|
||||
exporters: [logging, file]
|
||||
|
||||
extensions: [health_check, pprof, zpages]
|
|
@ -1,81 +0,0 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.opentelemetry.smoketest
|
||||
|
||||
import io.opentelemetry.auto.test.utils.PortUtils
|
||||
import okhttp3.Request
|
||||
import spock.lang.Shared
|
||||
|
||||
class WildflySmokeTest extends AbstractServerSmokeTest {
|
||||
|
||||
@Shared
|
||||
File wildflyDirectory = new File(System.getProperty("io.opentelemetry.smoketest.wildflyDir"))
|
||||
@Shared
|
||||
int httpsPort = PortUtils.randomOpenPort()
|
||||
@Shared
|
||||
int managementPort = PortUtils.randomOpenPort()
|
||||
|
||||
@Override
|
||||
ProcessBuilder createProcessBuilder() {
|
||||
String ext = System.getProperty("os.name").startsWith("Windows") ? ".bat" : ".sh"
|
||||
ProcessBuilder processBuilder =
|
||||
new ProcessBuilder("${wildflyDirectory}/bin/standalone" + ext)
|
||||
processBuilder.directory(wildflyDirectory)
|
||||
|
||||
// We're installing a span exporter to make sure it doesn't blow anything up, but we're not
|
||||
// checking the spans, since JBoss seems to redirect stdout to something we don't have (easy) access to.
|
||||
processBuilder.environment().put("JAVA_OPTS",
|
||||
defaultJavaProperties.join(" ")
|
||||
+ " -Dotel.exporter.jar=${exporterPath}"
|
||||
+ " -Dotel.exporter.logging.prefix=LOGGED_SPAN"
|
||||
+ " -Djboss.http.port=${httpPort} -Djboss.https.port=${httpsPort}"
|
||||
+ " -Djboss.management.http.port=${managementPort}")
|
||||
return processBuilder
|
||||
}
|
||||
|
||||
def cleanupSpec() {
|
||||
String ext = System.getProperty("os.name").startsWith("Windows") ? ".bat" : ".sh"
|
||||
ProcessBuilder processBuilder = new ProcessBuilder(
|
||||
"${wildflyDirectory}/bin/jboss-cli" + ext,
|
||||
"--connect",
|
||||
"--controller=localhost:${managementPort}",
|
||||
"command=:shutdown")
|
||||
processBuilder.directory(wildflyDirectory)
|
||||
Process process = processBuilder.start()
|
||||
process.getOutputStream().close() // otherwise .bat file waits at end with "Press any key to continue . . ."
|
||||
process.waitFor()
|
||||
}
|
||||
|
||||
def "default home page #n th time"() {
|
||||
setup:
|
||||
String url = "http://localhost:$httpPort/"
|
||||
def request = new Request.Builder().url(url).get().build()
|
||||
|
||||
when:
|
||||
def response = client.newCall(request).execute()
|
||||
|
||||
then:
|
||||
def responseBodyStr = response.body().string()
|
||||
responseBodyStr != null
|
||||
responseBodyStr.contains("Your WildFly instance is running.")
|
||||
response.body().contentType().toString().contains("text/html")
|
||||
response.code() == 200
|
||||
|
||||
where:
|
||||
n << (1..200)
|
||||
}
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
ext {
|
||||
serverName = 'wildfly'
|
||||
serverModule = 'servlet'
|
||||
serverVersion = '15.0.0.Final'
|
||||
serverExtension = 'zip'
|
||||
|
||||
minJavaVersionForTests = JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
ivy {
|
||||
url 'https://download.jboss.org/'
|
||||
patternLayout {
|
||||
artifact '/[organisation]/[revision]/[module]/[organisation]-[module]-[revision].[ext]'
|
||||
metadataSources {
|
||||
artifact()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
apply from: "$rootDir/gradle/java.gradle"
|
||||
|
||||
description = 'Wildfly Smoke Tests.'
|
||||
|
||||
dependencies {
|
||||
// uses the ivy repository url to download the wildfly servlet zip
|
||||
// organisation = serverName, revision = serverVersion, module = serverModule, ext = serverExtension
|
||||
implementation "${serverName}:${serverModule}:${serverVersion}@${serverExtension}"
|
||||
|
||||
testImplementation project(':smoke-tests')
|
||||
}
|
||||
|
||||
tasks.register("unzip", Copy) {
|
||||
def zipFileNamePrefix = "servlet"
|
||||
def zipPath = project.configurations.runtimeClasspath.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)
|
||||
}
|
||||
|
||||
// When tests are disabled this would still be run, so disable this manually
|
||||
onlyIf { !project.rootProject.hasProperty("skipTests") }
|
||||
}
|
||||
|
||||
tasks.withType(Test).configureEach {
|
||||
dependsOn unzip
|
||||
|
||||
jvmArgs "-Dio.opentelemetry.smoketest.wildflyDir=${buildDir}/${serverName}-${serverModule}-${serverVersion}"
|
||||
}
|
Loading…
Reference in New Issue