|
| 1 | +# GitHub Workflows |
| 2 | + |
| 3 | +## Quarantine/Disable Test Workflow |
| 4 | + |
| 5 | +The `quarantine-test.yml` workflow allows repository maintainers to quarantine, unquarantine, disable, or enable tests directly from issue or PR comments. |
| 6 | + |
| 7 | +### Commands |
| 8 | + |
| 9 | +| Command | Description | Attribute Used | |
| 10 | +|---------|-------------|----------------| |
| 11 | +| `/quarantine-test` | Mark test(s) as quarantined (flaky) | `[QuarantinedTest]` | |
| 12 | +| `/unquarantine-test` | Remove quarantine from test(s) | Removes `[QuarantinedTest]` | |
| 13 | +| `/disable-test` | Disable test(s) due to an active issue | `[ActiveIssue]` | |
| 14 | +| `/enable-test` | Re-enable previously disabled test(s) | Removes `[ActiveIssue]` | |
| 15 | + |
| 16 | +### Syntax |
| 17 | + |
| 18 | +``` |
| 19 | +/quarantine-test <test-name(s)> <issue-url> [--target-pr <pr-url>] |
| 20 | +/unquarantine-test <test-name(s)> [--target-pr <pr-url>] |
| 21 | +/disable-test <test-name(s)> <issue-url> [--target-pr <pr-url>] |
| 22 | +/enable-test <test-name(s)> [--target-pr <pr-url>] |
| 23 | +``` |
| 24 | + |
| 25 | +### Parameters |
| 26 | + |
| 27 | +| Parameter | Required | Description | |
| 28 | +|-----------|----------|-------------| |
| 29 | +| `<test-name(s)>` | Yes | One or more test method names (space-separated) | |
| 30 | +| `<issue-url>` | For quarantine/disable | URL of the GitHub issue tracking the problem | |
| 31 | +| `--target-pr <pr-url>` | No | Push changes to an existing PR instead of creating a new one | |
| 32 | + |
| 33 | +### Examples |
| 34 | + |
| 35 | +#### Quarantine a flaky test (creates new PR) |
| 36 | +``` |
| 37 | +/quarantine-test MyTestClass.MyTestMethod https://github.com/dotnet/aspire/issues/1234 |
| 38 | +``` |
| 39 | + |
| 40 | +#### Quarantine multiple tests |
| 41 | +``` |
| 42 | +/quarantine-test TestMethod1 TestMethod2 TestMethod3 https://github.com/dotnet/aspire/issues/1234 |
| 43 | +``` |
| 44 | + |
| 45 | +#### Quarantine a test and push to an existing PR |
| 46 | +``` |
| 47 | +/quarantine-test MyTestMethod https://github.com/dotnet/aspire/issues/1234 --target-pr https://github.com/dotnet/aspire/pull/5678 |
| 48 | +``` |
| 49 | + |
| 50 | +#### Unquarantine a test (creates new PR) |
| 51 | +``` |
| 52 | +/unquarantine-test MyTestClass.MyTestMethod |
| 53 | +``` |
| 54 | + |
| 55 | +#### Unquarantine and push to an existing PR |
| 56 | +``` |
| 57 | +/unquarantine-test MyTestMethod --target-pr https://github.com/dotnet/aspire/pull/5678 |
| 58 | +``` |
| 59 | + |
| 60 | +#### Disable a test due to an active issue |
| 61 | +``` |
| 62 | +/disable-test MyTestMethod https://github.com/dotnet/aspire/issues/1234 |
| 63 | +``` |
| 64 | + |
| 65 | +#### Enable a previously disabled test |
| 66 | +``` |
| 67 | +/enable-test MyTestMethod |
| 68 | +``` |
| 69 | + |
| 70 | +#### Comment on a PR to push changes to that PR |
| 71 | +When you comment on a PR (not an issue), the workflow will automatically push changes to that PR's branch instead of creating a new PR. You can override this by specifying `--target-pr`. |
| 72 | + |
| 73 | +### Behavior |
| 74 | + |
| 75 | +1. **Permission Check**: Only users with write access to the repository can use these commands. |
| 76 | +2. **Processing Indicator**: The workflow adds an 👀 reaction to your comment when it starts processing. |
| 77 | +3. **Status Comments**: The workflow posts comments to indicate: |
| 78 | + - ⏳ Processing started |
| 79 | + - ✅ Success (with link to created/updated PR) |
| 80 | + - ℹ️ No changes needed (test already in desired state) |
| 81 | + - ❌ Failure (with error details) |
| 82 | + |
| 83 | +### Target PR Behavior |
| 84 | + |
| 85 | +| Context | `--target-pr` specified | Result | |
| 86 | +|---------|-------------------------|--------| |
| 87 | +| Comment on Issue | No | Creates new PR from `main` | |
| 88 | +| Comment on Issue | Yes | Pushes to specified PR | |
| 89 | +| Comment on PR | No | Pushes to that PR's branch | |
| 90 | +| Comment on PR | Yes | Pushes to specified PR (overrides) | |
| 91 | + |
| 92 | +### Restrictions |
| 93 | + |
| 94 | +- The `--target-pr` URL must be from the same repository |
| 95 | +- Cannot push to PRs from forks |
| 96 | +- Cannot push to closed PRs |
| 97 | +- The PR branch must not be protected in a way that prevents pushes |
| 98 | + |
| 99 | +### Concurrency |
| 100 | + |
| 101 | +The workflow uses concurrency groups based on the issue/PR number to prevent race conditions when multiple commands are issued on the same issue. |
0 commit comments