Skip to content

Commit 8dff9b5

Browse files
committed
Update readme
1 parent 55c875e commit 8dff9b5

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

tools/flakeguard/README.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ go run main.go create-tickets --jira-project=DX --flaky-test-json-db-path=.flaky
4747
**Options:**
4848

4949
- `--jira-project`: The JIRA project key where tickets should be created (e.g., `DX`).
50-
- `--flaky-test-json-db-path`: The path to a JSON database (`.json`) that stores information about existing flaky test tickets.
50+
- `--test-db-path`: The path to a JSON database (`.json`) that stores information about existing flaky test tickets.
5151
- `--assignee-mapping`: The path to a JSON file (`.json`) that maps test packages to JIRA assignees.
5252
- `--csv-path`: The path to the CSV file containing the flaky test results.
5353
- `--skip-existing`: (Optional) Skips creating tickets for tests that already have corresponding JIRA tickets in the database or JIRA.
@@ -59,6 +59,30 @@ go run main.go create-tickets --jira-project=DX --flaky-test-json-db-path=.flaky
5959
- `JIRA_EMAIL`: The email address used to authenticate with JIRA.
6060
- `JIRA_API_KEY`: The API key used to authenticate with JIRA.
6161

62+
### Managing Tickets
63+
The new tickets command lets you interactively manage your flaky test tickets stored in your local JSON database. With this command you can:
64+
65+
- Mark tests as skipped: Post a comment to the associated JIRA ticket and update the local DB.
66+
- Unskip tests: Remove the skipped status and post an unskip comment.
67+
- Navigate tickets: Use a TUI to browse through tickets.
68+
69+
```
70+
go run main.go tickets --test-db-path=.flaky_test_db.json --jira-comment
71+
```
72+
73+
**Options:**
74+
75+
- `--test-db-path`: The path to a JSON database (.json) that stores information about your flaky test tickets.
76+
- `--jira-comment`: If set to true, posts a comment to the corresponding JIRA ticket when marking a test as skipped or unskipped.
77+
`--dry-run`: (Optional) Runs the command in dry-run mode without posting comments to JIRA.
78+
- `--hide-skipped`: (Optional) If set, tickets already marked as skipped are hidden from the interface.
79+
80+
**Environment Variables:**
81+
82+
- `JIRA_DOMAIN`: The domain of your JIRA instance.
83+
- `JIRA_EMAIL`: The email address used to authenticate with JIRA.
84+
- `JIRA_API_KEY`: The API key used to authenticate with JIRA.
85+
6286
### Example Run
6387

6488
You can find example usage and see outputs with:

tools/flakeguard/cmd/tickets.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ var (
2020
ticketsJSONPath string
2121
jiraComment bool // if true, post a comment when marking as skipped
2222
ticketsDryRun bool // if true, do not send anything to Jira
23+
hideSkipped bool // if true, do not show skipped tests
2324
)
2425

2526
// TicketsCmd is the new CLI command for managing tickets.
@@ -62,6 +63,17 @@ You can later extend this command to support additional actions.`,
6263
}
6364
}
6465

66+
// If the hideSkipped flag is set, filter out tickets with a non-zero SkippedAt.
67+
if hideSkipped {
68+
filtered := make([]model.FlakyTicket, 0, len(tickets))
69+
for _, t := range tickets {
70+
if t.SkippedAt.IsZero() {
71+
filtered = append(filtered, t)
72+
}
73+
}
74+
tickets = filtered
75+
}
76+
6577
// 3) Setup a Jira client (if available).
6678
jiraClient, clientErr := jirautils.GetJiraClient()
6779
if clientErr != nil {
@@ -96,6 +108,7 @@ func init() {
96108
TicketsCmd.Flags().StringVar(&ticketsJSONPath, "test-db-path", "flaky_test_db.json", "Path to the JSON file containing tickets")
97109
TicketsCmd.Flags().BoolVar(&jiraComment, "jira-comment", true, "If true, post a comment to the Jira ticket when marking as skipped")
98110
TicketsCmd.Flags().BoolVar(&ticketsDryRun, "dry-run", false, "If true, do not send anything to Jira")
111+
TicketsCmd.Flags().BoolVar(&hideSkipped, "hide-skipped", false, "If true, do not show skipped tests")
99112
}
100113

101114
// -------------------------

0 commit comments

Comments
 (0)