Skip to content

Commit

Permalink
Ignore Notes from alloc_status command
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoche committed Jun 3, 2024
1 parent 5b1b261 commit 7d921be
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
1 change: 0 additions & 1 deletion api/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ type AllocCheckStatus struct {
Service string
Task string
Status string
Notes string
StatusCode int
Timestamp int64
}
Expand Down
6 changes: 3 additions & 3 deletions command/alloc_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,14 +374,14 @@ func formatAllocNomadServiceChecks(allocID string, client *api.Client) string {
} else if len(statuses) == 0 {
return ""
}
results := []string{"Service|Task|Name|Mode|Status|Notes"}
results := []string{"Service|Task|Name|Mode|Status"}
for _, status := range statuses {
task := "(group)"
if status.Task != "" {
task = status.Task
}
// check | group | mode | status | notes
s := fmt.Sprintf("%s|%s|%s|%s|%s|%s", status.Service, task, status.Check, status.Mode, status.Status, status.Notes)
// check | group | mode | status
s := fmt.Sprintf("%s|%s|%s|%s|%s", status.Service, task, status.Check, status.Mode, status.Status)
results = append(results, s)
}
sort.Strings(results[1:])
Expand Down
4 changes: 2 additions & 2 deletions command/alloc_status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,6 @@ func TestAllocStatusCommand_NSD_Checks(t *testing.T) {
// check output
out := ui.OutputWriter.String()
must.StrContains(t, out, `Nomad Service Checks:`)
must.RegexMatch(t, regexp.MustCompile(`Service\s+Task\s+Name\s+Mode\s+Status\s+Notes`), out)
must.RegexMatch(t, regexp.MustCompile(`service1\s+\(group\)\s+check1\s+healthiness\s+(pending|failure)\s+note1`), out)
must.RegexMatch(t, regexp.MustCompile(`Service\s+Task\s+Name\s+Mode\s+Status`), out)
must.RegexMatch(t, regexp.MustCompile(`service1\s+\(group\)\s+check1\s+healthiness\s+(pending|failure)`), out)
}
1 change: 0 additions & 1 deletion command/testing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ func testNomadServiceJob(jobID string) *api.Job {
Path: "/",
Interval: 1 * time.Second,
Timeout: 1 * time.Second,
Notes: "note1",
}},
Provider: "nomad",
}}
Expand Down

0 comments on commit 7d921be

Please sign in to comment.