Skip to content

Commit 32fc939

Browse files
jaydelucasteverao
andauthored
Update docs for running tests (#12987)
Co-authored-by: Steve Rao <[email protected]>
1 parent 35f01f8 commit 32fc939

File tree

3 files changed

+33
-30
lines changed

3 files changed

+33
-30
lines changed

CONTRIBUTING.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ https://gradle.com/s/ila4qwp5lcf5s
8787
```
8888

8989
Opening the build scan link can sometimes take several seconds (it's a large build), but it
90-
typically makes it a lot clearer what's failing.
90+
typically makes it a lot clearer what's failing. Sometimes there will be several build scans in a
91+
log, so look for one that follows the "BUILD FAILED" message.
9192

9293
You can also try the "Explain error" button at the top of the GitHub Actions page,
9394
which often does a reasonable job of parsing the long build log and displaying the important part.

docs/contributing/debugging.md

+11
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33
Debugging javaagent instrumentation can be a challenging task since instrumentation
44
code is directly inlined into target classes.
55

6+
## Indy compatible instrumentation
7+
8+
For instrumentation that has been migrated to use the
9+
[invokedynamic based instrumentation mechanism](https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/8999),
10+
you can leverage breakpoints and standard debugging strategies by adding `-PtestIndy=true` to the
11+
gradle command when running tests:
12+
13+
```
14+
./gradlew -PtestIndy=true :instrumentation:<INSTRUMENTATION_NAME>:test
15+
```
16+
617
## Advice methods
718

819
Breakpoints do not work in advice methods, because their code is directly inlined

docs/contributing/running-tests.md

+20-29
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
Open Telemetry Auto Instrumentation's minimal supported version is java 8.
66
All jar files that we produce, unless noted otherwise, have bytecode
7-
compatible with java 8 runtime. Our test suite is executed against
7+
compatibility with the java 8 runtime. Our test suite is executed against
88
java 8, all LTS versions and the latest non-LTS version.
99

1010
Some libraries that we auto-instrument may have higher minimal requirements.
11-
In this case we compile and test corresponding auto-instrumentation with
12-
higher java version as required by library. The resulting classes will have
13-
higher bytecode level, but as it matches library's java version, no runtime
14-
problem arise.
11+
In these cases, we compile and test the corresponding auto-instrumentation with
12+
higher java versions as required by the libraries. The resulting classes will
13+
have a higher bytecode level, but since it will match the library's java version,
14+
no runtime problems arise.
1515

1616
## Instrumentation tests
1717

@@ -22,10 +22,11 @@ instrumented library.
2222

2323
### Executing tests with specific java version
2424

25-
We run all tests on Java 11 by default, along with Java 8 and 15. To run on the later, set the
26-
`testJavaVersion` Gradle property to the desired major version, e.g., `./gradlew test -PtestJavaVersion=8`,
27-
`./gradlew test -PtestJavaVersion=15`. If you don't have a JDK of these versions
28-
installed, Gradle will automatically download it for you.
25+
We run all tests on `Java 21` by default, along with Java 8, 11, 17, and 23. To run on
26+
a specific version, set the `testJavaVersion` gradle property to the desired major
27+
version, e.g., `./gradlew test -PtestJavaVersion=8`, `./gradlew test -PtestJavaVersion=23`.
28+
If you don't have a JDK of these versions installed, Gradle will automatically download
29+
it for you.
2930

3031
### Executing tests against the latest versions of libraries under instrumentation
3132

@@ -36,7 +37,7 @@ To run these tests locally, add `-PtestLatestDeps=true` to your existing `gradle
3637

3738
### Executing single test
3839

39-
Executing `./gradlew :instrumentation:<INSTRUMENTATION_NAME>:test --tests <GROOVY TEST FILE NAME>` will run only the selected test.
40+
Executing `./gradlew :instrumentation:<INSTRUMENTATION_NAME>:test --tests <TEST FILE NAME>` will run only the selected test.
4041

4142
### How to prevent linting and formatting warnings from failing tests
4243

@@ -52,7 +53,7 @@ The `dev` flag will ignore warnings in tests.
5253

5354
## Smoke tests
5455

55-
The smoke tests are not run as part of a global `test` task run since they take a long time and are
56+
The smoke tests are not run as part of a global `test` task since they take a long time and are
5657
not relevant for most contributions. Explicitly specify `:smoke-tests:test` to run them.
5758

5859
If you need to run a specific smoke test suite:
@@ -73,11 +74,10 @@ If you want to run a specific smoke test:
7374
./gradlew :smoke-tests:test --tests '*SpringBootSmokeTest*'
7475
```
7576

76-
## Smoke OpenTelemetry starter tests
77+
## OpenTelemetry starter smoke tests
7778

78-
Smoke tests for the [OpenTelemetry Spring starter](../../instrumentation/spring/starters/spring-boot-starter/README.md).
79-
80-
You can execute the tests in a JVM (`./gradlew smoke-tests-otel-starter:test`) or as Spring native tests (`./gradlew smoke-tests-otel-starter:nativeTest`).
79+
Smoke tests for the [OpenTelemetry Spring starter](../../instrumentation/spring/starters/spring-boot-starter/README.md)
80+
can be executed in a JVM (`./gradlew smoke-tests-otel-starter:test`) or as Spring Native tests (`./gradlew smoke-tests-otel-starter:nativeTest`).
8181

8282
## GraalVM native test
8383

@@ -100,22 +100,13 @@ old containers, images and volumes using `docker system prune --volumes`.
100100
For some container environments, such as rootless Podman or a remotely hosted Docker,
101101
testcontainers may need additional configuration to successfully run the tests.
102102
The following environment variables can be used for configuration:
103-
- `TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE` - The location of the Docker socket on the host. Default is `/var/run/docker.sock`
104-
- `TESTCONTAINERS_HOST_OVERRIDE` - The hostname used for container-to-container communication. Default Docker is `localhost`, but rootless Podman uses `host.containers.internal`
103+
- `TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE` - The location of the Docker socket on the host. Default is `/var/run/docker.sock`
104+
- `TESTCONTAINERS_HOST_OVERRIDE` - The hostname used for container-to-container communication. Default Docker is `localhost`, but rootless Podman uses `host.containers.internal`
105105

106106
# Troubleshooting CI Test Failures
107107

108-
CI test logs are pretty big around 75MB. To make it easier to troubleshoot test failures, you can download the raw logs from the CI job and then look for
109-
`Publishing build scan...` in the logs. Copy the URL from the logs and open it in a browser. This will give you a nice view of the test execution breakdown.
110-
111-
## How to download the raw logs
108+
See [Troubleshooting CI Test Failures](../../CONTRIBUTING.md#troubleshooting-pr-build-failures) for common issues and solutions.
112109

113-
1. Click on the `Details` link in one of the failing CI jobs under `Some checks were not successful` section of your PR.
114-
2. Click on one of the failed tests in the left panel.
115-
3. Click on the `Setting` gear in the top right corner of the logs panel.
116-
4. Right click on 'View raw logs' and then 'Save link as' to save the page as a text file locally.
117-
5. Once the file is downloaded, open it in a text editor and search for `Publishing build scan...` to find the URL.
118-
6. Open the URL in a browser to view the test execution breakdown. It might prompt you to "Activate your Build Scan" the very 1st time, you can use your own email address and activate it via email.
110+
# Debugging
119111

120-
Unfortunately, the Build Scan service hosted via Develocity has an allowed size limits of the free build scans. Once you exceed the limit, then you won't be able to view the scan anymore.
121-
Then you can just use the raw logs to search for "FAILED" or "Task failed with an exception" to identify the failing tests.
112+
For information on debugging tests or instrumentation, see [Debugging](debugging.md).

0 commit comments

Comments
 (0)