Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions flaky-tests/quarantining/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,26 @@ You can also wrap the test command with the Trunk Analytics CLI. When wrapping t
</Tab>
</Tabs>

## Quarantining without uploading

If you want quarantining to gate your CI job but don't want that run's test results uploaded to Trunk, pass the `--dry-run` flag (or set the `TRUNK_DRY_RUN=true` environment variable) to the `upload` or `test` command:

```bash
./trunk-analytics-cli upload \
--org-url-slug $TRUNK_ORG_URL_SLUG \
--token $TRUNK_API_TOKEN \
--junit-paths $JUNIT_PATH \
--dry-run
```

With `--dry-run`, the CLI still checks your failed tests against Trunk's quarantine service and overrides the exit code — returning `0` when all failures are quarantined — but writes the test results bundle to a local `./bundle_upload` directory instead of uploading it to Trunk.

Keep in mind:

* An organization token and network access are still required; the quarantine check queries Trunk's backend to determine which tests are quarantined.
* Because nothing is uploaded, the run won't appear in your dashboard or contribute to [flaky test detection](../detection/). Quarantining decisions are based on results from your other, uploading CI jobs.
* The local bundle written to `./bundle_upload` can also be useful for inspecting exactly what the CLI would have uploaded.

## Overriding individual tests

If you have tests that should never be quarantined or should always be quarantined regardless of their current health status, you can do this by overriding individual tests.
Expand Down
1 change: 1 addition & 0 deletions flaky-tests/reference/cli-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ The `upload` and `test` commands accept the following options:
| `--allow-empty-test-results` | Don't fail commands if test results are empty or missing. Use it when you sometimes skip all tests for certain CI jobs. Defaults to `true`. |
| `--variant <VARIANT_NAME>` | Upload tests to a specific variant group. **Optional**. |
| `--test-process-exit-code` `<EXIT_CODE>` | Specify the exit code of the test previously run. This is used by the upload command to identify errors that happen outside of the context of the test execution (such as build errors). |
| `--dry-run` | Write the test results bundle to a local `./bundle_upload` directory instead of uploading it to Trunk. [Quarantining](../quarantining/#quarantining-without-uploading) still runs and still determines the exit code. Can also be set with the `TRUNK_DRY_RUN=true` environment variable. **Optional**. |

<Info>
**Memory Overhead**
Expand Down