Skip to content

Commit

Permalink
test(instrumentation): convert Spring boot test apps to simple Java apps
Browse files Browse the repository at this point in the history
We do not actually need to start a whole framework with an HTTP server
to check one environment variable and exit.

Also:
- disable all auto-instrumentation by the Java agent for JVM
  instrumentation image tests
- remove Node.js 18 Bullseye base image for Node.js tests

All of this should help to speed up the instrumentation image tests.
  • Loading branch information
basti1302 committed Feb 2, 2025
1 parent 54965be commit b4b9aff
Show file tree
Hide file tree
Showing 35 changed files with 48 additions and 1,129 deletions.
1 change: 0 additions & 1 deletion images/instrumentation/test/jvm/.m2/.gitignore

This file was deleted.

Empty file.
4 changes: 0 additions & 4 deletions images/instrumentation/test/jvm/.m2/settings.xml

This file was deleted.

7 changes: 6 additions & 1 deletion images/instrumentation/test/jvm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ FROM ${test_image}
COPY test-cases /test-cases
COPY .m2 /.m2

RUN for test in /test-cases/*; do (cd "/${test}" && JAVA_HOME=$(which java | xargs dirname | xargs dirname) "./mvnw" "-gs" "/.m2/settings.xml" package); done
RUN export JAVA_HOME=$(which java | xargs dirname | xargs dirname)
RUN for test in /test-cases/*; do \
cd "/${test}" && \
javac Main.java && \
jar -cfm app.jar MANIFEST.MF *.class \
; done

# The following lines emulate the behavior of running the instrumentation image as a Kubernetes init container and
# setting the LD_PRELOAD environment variable via the operator.
Expand Down
1 change: 1 addition & 0 deletions images/instrumentation/test/jvm/test-cases/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.class

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Manifest-Version: 1.0
Main-Class: Main
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
public class Main {

public static void main(String[] args) {
String value = System.getenv("AN_ENVIRONMENT_VARIABLE");
if (!"value".equals(value)) {
throw new RuntimeException(String.format("Unexpected value for the 'AN_ENVIRONMENT_VARIABLE' env var: %s", value));
}
}
}
259 changes: 0 additions & 259 deletions images/instrumentation/test/jvm/test-cases/existing-unmodified/mvnw

This file was deleted.

This file was deleted.

Loading

0 comments on commit b4b9aff

Please sign in to comment.