You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/how_to_test.md
+15-18Lines changed: 15 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -4,25 +4,25 @@
4
4
5
5
The project leverages different types of test:
6
6
7
-
1. The most common ones are **unit tests**.
7
+
1. The most common ones are **unit tests**.
8
8
They are intended to test a single isolated feature, and rely on [JUnit 5 framework](https://junit.org/junit5/docs/current/user-guide/) or [Spock 2 framework](https://spockframework.org/spock/docs/).
9
9
JUnit framework is recommended for most unit tests for its simplicity and performance reasons.
10
10
Spock framework provides an alternative for more complex test scenarios, or tests that requires Groovy Script to access data outside their scope limitation (eg private fields).
11
11
12
-
2. A variant of unit tests are **instrumented tests**.
12
+
2. A variant of unit tests are **instrumented tests**.
13
13
Their purpose is similar to the unit tests but the tested code is instrumented by the java agent (`:dd-trace-java:java-agent`) while running. They extend the Spock specification `datadog.trace.agent.test.AgentTestRunner` which allows to test produced traces and metrics.
14
14
15
-
3. The third type of tests are **Muzzle checks**.
15
+
3. The third type of tests are **Muzzle checks**.
16
16
Their goal is to check the [Muzzle directives](./how_instrumentations_work.md#muzzle), making sure instrumentations are safe to load against specific library versions.
17
17
18
-
3. The fourth type of tests are **integration tests**.
18
+
3. The fourth type of tests are **integration tests**.
19
19
They test features that requires a more complex environment setup.
20
20
In order to build such enviroments, integration tests use Testcontainers to setup the services needed to run the tests.
21
21
22
-
4. The fifth type of test are **smoke tests**.
23
-
They are dedicated to test the java agent (`:dd-java-agent`) behavior against demo applications to prevent any regression. All smoke tests are located into the `:dd-smoke-tests` module.
22
+
4. The fifth type of test are **smoke tests**.
23
+
They are dedicated to test the java agent (`:dd-java-agent`) behavior against demo applications to prevent any regression. All smoke tests are located into the `:dd-smoke-tests` module.
24
24
25
-
5. The last type of test are **system tests**.
25
+
5. The last type of test are **system tests**.
26
26
They are intended to test behavior consistency between all the client libraries, and relies on [their on GitHub repository](https://github.com/DataDog/system-tests).
27
27
28
28
> [!TIP]
@@ -43,10 +43,12 @@ This mechanism exists to make sure either java agent state or static data are re
43
43
If a test runs unreliably, or doen't have a fully deterministic behavior, this will lead into recurrent unexpected errors in continuous integration.
44
44
In order to identify such tests and avoid the continuous integration to fail, they are marked as _flaky_ and must be annotated with the `@Flaky` annotation.
45
45
46
-
> [!TIP]
47
-
> In case your pull request checks failed due to some unexpected flaky tests, you can retry the continous integration pilepeline on CircleCI using the `Rerun workflow from failed` button:
46
+
If your pull request fails CI due to apparently unrelated problems, follow these steps:
48
47
49
-

48
+
1. check logs in gitlab. There could be some useful info, like clear evidence that test failed due to infrastructure problems
49
+
2. try to run the failed test locally. Usually in the gitlab logs there will be a gradle command that can be executed locally
50
+
3. simply restart the job couple of times, some of tests are flaky
51
+
4. ask for help in the dd-trace-java chat channel
50
52
51
53
## Running Tests
52
54
@@ -74,12 +76,7 @@ To run tests on a different JVM than the one used for doing the build, you need
74
76
The system tests are setup to run on continous integration as pull request check.
75
77
76
78
If you would like to run them locally, you would have to grab [a local copy of the system tests](https://github.com/DataDog/system-tests), and run them from there.
77
-
You can make them use your development version of `dd-trace-java` by [dropping the built artifacts to the `/binaries` folder](https://github.com/DataDog/system-tests/blob/main/docs/execute/binaries.md#java-library) of your local copy of the system tests.
78
-
79
-
If you would like to run another version of the system tests on continuous integration, or update them to the latest version, you would need to use [the update pinned system tests script](../.circleci/update_pinned_system_tests.sh) as your pull request won't use the latest `main` version from the system test repository, but a pinned version.
80
-
81
-
> [!NOTE]
82
-
> The system tests version used for continous integration is defined using `default_system_tests_commit` in [CircleCI configuration](../.circleci/config.continue.yml.j2).
79
+
You can make them use your development version of `dd-trace-java` by [dropping the built artifacts to the `/binaries` folder](https://github.com/DataDog/system-tests/blob/main/docs/execute/binaries.md#java-library) of your local copy of the system tests.
83
80
84
81
### The APM test agent
85
82
@@ -90,6 +87,6 @@ Trace Check results are returned within the `Get APM Test Agent Trace Check Resu
90
87
Check [trace invariant checks](https://github.com/DataDog/dd-apm-test-agent#trace-invariant-checks) for more informations.
91
88
92
89
The APM Test Agent also emits helpful logging, including logging received traces' headers, spans, errors encountered,
93
-
ands information on trace checks being performed.
94
-
Logs can be viewed in CircleCI within the Test-Agent container step for all instrumentation test suites, ie: `z_test_8_inst` job.
90
+
ands information on trace checks being performed.
91
+
Logs can be viewed in CI within the Test-Agent container step for all instrumentation test suites, ie: `z_test_8_inst` job.
95
92
Read more about [the APM Test Agent](https://github.com/datadog/dd-apm-test-agent#readme).
0 commit comments