Commit 472230fba4
Verified · cmc ci/build: success ci/test: success
Layout: unified · split
internal/httpd/builds.go +8 −1
| @@ -108,7 +108,9 @@ func combinedStatus(builds []control.BuildOut) string { | |||
| 108 | 108 | ||
| 109 | // worstStatus is combinedStatus's ordering rule, factored out so the | 109 | // worstStatus is combinedStatus's ordering rule, factored out so the |
| 110 | // dashboard feed can apply the same worst-first precedence to a folded | 110 | // dashboard feed can apply the same worst-first precedence to a folded |
| 111 | // build run (D04). | 111 | // build run (D04). A status outside runStatusPriority (a future state |
| 112 | // such as "skipped") is still not "success": it is returned unchanged | ||
| 113 | // rather than falling through and reading as green. | ||
| 112 | func worstStatus(statuses []string) string { | 114 | func worstStatus(statuses []string) string { |
| 113 | has := map[string]bool{} | 115 | has := map[string]bool{} |
| 114 | for _, s := range statuses { | 116 | for _, s := range statuses { |
| @@ -119,6 +121,11 @@ func worstStatus(statuses []string) string { | |||
| 119 | return s | 121 | return s |
| 120 | } | 122 | } |
| 121 | } | 123 | } |
| 124 | for _, s := range statuses { | ||
| 125 | if s != "success" { | ||
| 126 | return s | ||
| 127 | } | ||
| 128 | } | ||
| 122 | return "success" | 129 | return "success" |
| 123 | } | 130 | } |
| 124 | 131 | ||
internal/httpd/builds_test.go +4
| @@ -55,6 +55,10 @@ func TestGroupRunsCombinedStatusPriority(t *testing.T) { | |||
| 55 | {[]string{"running", "cancelled"}, "cancelled"}, | 55 | {[]string{"running", "cancelled"}, "cancelled"}, |
| 56 | {[]string{"cancelled", "failure"}, "failure"}, | 56 | {[]string{"cancelled", "failure"}, "failure"}, |
| 57 | {[]string{"success", "success", "failure"}, "failure"}, | 57 | {[]string{"success", "success", "failure"}, "failure"}, |
| 58 | // A status outside runStatusPriority (a future state such as | ||
| 59 | // "skipped") is still not success: it must not fall through to | ||
| 60 | // the "success" default and read as green. | ||
| 61 | {[]string{"success", "skipped"}, "skipped"}, | ||
| 58 | } | 62 | } |
| 59 | for _, tc := range cases { | 63 | for _, tc := range cases { |
| 60 | var builds []control.BuildOut | 64 | var builds []control.BuildOut |