If a test or feature is flaky or unstable, you can quarantine it to prevent it from failing pipelines. This allows pipelines to continue running without being affected. Once a test is quarantined, it will be skipped in all environments, and across all branches, until it is unquarantined.

How to quarantine a test

CLI

You can quarantine and unquarantine tests using the quarantine command in the Momentic CLI.
npx momentic quarantine add <test> --reason <reason>

Cloud

Select Quarantine on the left sidebar, and click the Quarantine test button in the top right corner.
To unquarantine a test, navigate to the same page, hover over the test to unquarantine, and select the Unquarantine option in the dropdown menu.
You can also quarantine a test directly from the run viewer, by clicking on the Quarantine test button in the top right corner of the page.

Quarantine rules

Quarantine rules are a way to define thresholds past which tests are automatically quarantined or unquarantined. This allows you to easily keep your test suite running smoothly without taking manual action.

Rule

The rule defines both the action to be taken, as well as when to take it. You can configure:
  • Whether to quarantine or unquarantine the test.
  • Which metric to use (options include pass rate, number of failures, and flake rate).
  • What threshold triggers the action.
  • What period to evaluate the metric over.

Filtering

In order to create more granular rules, you can configure additional filters so that the rule only applies to certain tests and runs:
  • Only apply to tests in a specific repository.
  • Only include runs on a particular branch. This is useful for quarantining tests that fail too often on main.
  • Only include tests with particular labels. This is useful if you have stricter rules for particular suites.