Add smoke tests documentation - #12282
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e352616c17
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ## Adding a new smoke-test module | ||
|
|
||
| 1. Register it in `settings.gradle.kts` (the `:dd-smoke-tests:*` list). | ||
| 2. Create `dd-smoke-tests/<name>/build.gradle` with the `application` and `com.gradleup.shadow` plugins, `testImplementation project(':dd-smoke-tests')`, and a `Test` task that publishes the app fixture: |
There was a problem hiding this comment.
Apply the smoke-test convention plugin
When a new module follows this recipe, the listed plugins omit dd-trace-java.module.smoke-test, even though that convention applies the repository's Java and test configuration, including JUnit Platform setup. The parent dd-smoke-tests/build.gradle only configures existing Test tasks and does not apply the convention to subprojects, so a JUnit 5 smoke test created from these instructions can be undiscovered or otherwise misconfigured; include the convention plugin in the required plugin list.
Useful? React with 👍 / 👎.
| 3. Write the application fixture under `src/main/java`, and the test under `src/test/java`. | ||
| 4. Refresh the module's `gradle.lockfile`. | ||
|
|
||
| The parent `dd-smoke-tests/build.gradle` already gives every subproject the agent jar, the build directory and the `:dd-smoke-tests` framework, so do not re-declare those. |
There was a problem hiding this comment.
Require the framework dependency in each subproject
The parent dd-smoke-tests/build.gradle supplies the agent-jar and build-directory properties, but it does not add testImplementation project(':dd-smoke-tests') to subprojects. Therefore the claim that the parent provides the framework contradicts step 2 and may lead readers to remove or omit the dependency, leaving classes such as SmokeServerApp unavailable; restrict this sentence to the two system properties and keep the framework dependency explicit.
Useful? React with 👍 / 👎.
| span() | ||
| .operationName("spring.handler") | ||
| .resourceName("MyController.success") | ||
| .childOfPrevious())); |
There was a problem hiding this comment.
Match the Spring handler span type
For the Spring MVC application represented by this example, a spring.handler span has the web span type, but an omitted SpanMatcher.type(...) is not a wildcard: SpanMatcher defaults to requiring a null or empty type. Consequently this advertised complete test keeps polling and then fails against a correct trace; add .type("web") to both handler matchers.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
That’s not the point of the example… 😞
| Use `getFlatMessages()` and `waitForFlat(...)` for almost everything. | ||
| The tracer batches events, so an `app-started` you are looking for usually arrives nested inside a `message-batch`. | ||
|
|
||
| One telemetry assertion runs at the first `afterEach` without you writing it: `assertTelemetryReceived()` checks that at least one message reached the backend. |
There was a problem hiding this comment.
Qualify the automatic telemetry assertion
When an app uses a separately registered shared backend, AbstractSmokeApp.afterEach explicitly skips assertTelemetryReceived() because backend.isShared() is true. The unconditional statement here can therefore let multi-app tests assume telemetry is validated when no automatic assertion runs; document the owned-backend restriction and direct shared-backend tests to assert through backend.telemetry() themselves.
Useful? React with 👍 / 👎.
| ## Adding a new smoke-test module | ||
|
|
||
| 1. Register it in `settings.gradle.kts` (the `:dd-smoke-tests:*` list). | ||
| 2. Create `dd-smoke-tests/<name>/build.gradle` with the `application` and `com.gradleup.shadow` plugins, `testImplementation project(':dd-smoke-tests')`, and a `Test` task that publishes the app fixture: |
There was a problem hiding this comment.
Configure an entry point for the fixture jar
Following this module recipe leaves the application plugin's mainClass unset and does not add a Main-Class manifest attribute. The resulting shadowJar is therefore not a runnable fixture for SmokeServerApp.jar(...) or SmokeCliApp.jar(...), and the child JVM exits immediately when launched with java -jar; include an application { mainClass = ... } block or equivalent manifest configuration.
Useful? React with 👍 / 👎.
| | `allowedErrorLogs("...")` | One test's known-noisy lines, matched by substring | | ||
| | `errorLogFilter(predicate)` | Full control over what counts as an error; replaces the allowlist | | ||
| | `skipErrorLogCheck()` | Tests that are *about* error cases | |
There was a problem hiding this comment.
Treat error-log exemptions as class-wide
These are builder settings on the static app extension, and the automatic assertNoErrorLogs() scans the entire log accumulated since class launch at afterAll; none of these options can be scoped to one test method. Using allowedErrorLogs(...) or skipErrorLogCheck() for a single error-case method therefore suppresses matching failures from every other method in the class, so describe them as suite-wide and advise isolating such cases in a separate class or performing explicit log assertions.
Useful? React with 👍 / 👎.
🟢 Java Benchmark SLOs — All performance SLOs passed
PR vs. master results
Commit: Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion. |
There was a problem hiding this comment.
The new module recipe does not work as written. The guide also says that telemetry checks always run, but the code skips them for shared backends and apps without the agent.
🤖 Datadog Autotest · Commit e352616 · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest
| ## Adding a new smoke-test module | ||
|
|
||
| 1. Register it in `settings.gradle.kts` (the `:dd-smoke-tests:*` list). | ||
| 2. Create `dd-smoke-tests/<name>/build.gradle` with the `application` and `com.gradleup.shadow` plugins, `testImplementation project(':dd-smoke-tests')`, and a `Test` task that publishes the app fixture: |
There was a problem hiding this comment.
Complete the Gradle module recipe
Contributors cannot create a working smoke-test module from this recipe.
Assertion details
- Input: A contributor copies step 2 to create a module that starts its fixture with
.jar(APPLICATION_JAR). - Expected: The recipe must include the convention plugin, the
ShadowJarimport, and an executable main-class configuration. - Actual: The recipe omits the smoke-test convention plugin and the
ShadowJarimport. It also does not configure a main class for the fixture thatSmokeServerApp.jar(...)starts withjava -jar. The copied script fails during Gradle configuration or produces a jar that cannot start.
Was this helpful? React 👍 or 👎
🤖 Datadog Autotest · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest
| Use `getFlatMessages()` and `waitForFlat(...)` for almost everything. | ||
| The tracer batches events, so an `app-started` you are looking for usually arrives nested inside a `message-batch`. | ||
|
|
||
| One telemetry assertion runs at the first `afterEach` without you writing it: `assertTelemetryReceived()` checks that at least one message reached the backend. |
There was a problem hiding this comment.
State the telemetry check limits
A test can omit telemetry validation while its author believes that the framework performs it.
Assertion details
- Input: A smoke test uses a shared backend or calls
noAgent(). - Expected:
The guide must state that the automatic check runs only for an agent-instrumented app with an owned backend. Other cases need an explicit assertion. - Actual:
AbstractSmokeApp.afterEachskips this assertion when the backend is shared or when the app has no agent.
Was this helpful? React 👍 or 👎
🤖 Datadog Autotest · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest
What Does This Do
This PR introduces documentation for the new smoke test framework.
Motivation
Help with discovery and adoption.
Additional Notes
Contributor Checklist
type:and (comp:orinst:) labels in addition to any other useful labelsclose,fix, or any linking keywords when referencing an issueUse
solvesinstead, and assign the PR milestone to the issueJira ticket: [PROJ-IDENT]