Skip to content

Commit 16d0fbf

Browse files
committed
eval status: sort plan annotations by task group
The plan annotations table isn't sorted by task group, which makes for a less beautiful UX and a flaky test.
1 parent 7c633f8 commit 16d0fbf

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

command/eval_status.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,8 +382,16 @@ func formatPlanAnnotations(desiredTGUpdates map[string]*api.DesiredUpdates, verb
382382
}
383383
}
384384

385+
taskGroups := []string{}
386+
for tg := range desiredTGUpdates {
387+
taskGroups = append(taskGroups, tg)
388+
}
389+
sort.StringSlice(taskGroups).Sort()
390+
385391
i := 1
386-
for tg, updates := range desiredTGUpdates {
392+
for _, tg := range taskGroups {
393+
updates := desiredTGUpdates[tg]
394+
387395
// we always show the first 5 columns
388396
annotations[i] = fmt.Sprintf("%s|%d|%d|%d|%d|%d",
389397
tg,

command/eval_status_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,6 @@ func TestEvalStatus_FormatPlanAnnotations(t *testing.T) {
236236

237237
out := formatPlanAnnotations(updates, false)
238238
must.Eq(t, `Task Group Ignore Place Stop InPlace Destructive Canary Reconnect
239-
foo 2 1 0 0 0 1 0
240-
bar 0 1 3 0 0 0 2`, out)
239+
bar 0 1 3 0 0 0 2
240+
foo 2 1 0 0 0 1 0`, out)
241241
}

0 commit comments

Comments
 (0)