@@ -18,6 +18,7 @@ package status
1818
1919import (
2020 "context"
21+ "errors"
2122 "fmt"
2223 "sort"
2324 "strings"
@@ -85,19 +86,28 @@ func (sc *StatusChecker) Assess(identifiers ...object.ObjMetadata) error {
8586 sort .SliceStable (identifiers , func (i , j int ) bool {
8687 return strings .Compare (identifiers [i ].Name , identifiers [j ].Name ) < 0
8788 })
89+ var errs []error
8890 for _ , id := range identifiers {
8991 rs := coll .ResourceStatuses [id ]
9092 switch rs .Status {
9193 case status .CurrentStatus :
9294 sc .logger .Successf ("%s: %s ready" , rs .Identifier .Name , strings .ToLower (rs .Identifier .GroupKind .Kind ))
9395 case status .NotFoundStatus :
94- sc .logger .Failuref ("%s: %s not found" , rs .Identifier .Name , strings .ToLower (rs .Identifier .GroupKind .Kind ))
96+ errMsg := fmt .Sprintf ("%s: %s not found" , rs .Identifier .Name , strings .ToLower (rs .Identifier .GroupKind .Kind ))
97+ sc .logger .Failuref (errMsg )
98+ errs = append (errs , errors .New (errMsg ))
9599 default :
96- sc .logger .Failuref ("%s: %s not ready" , rs .Identifier .Name , strings .ToLower (rs .Identifier .GroupKind .Kind ))
100+ errMsg := fmt .Sprintf ("%s: %s not ready" , rs .Identifier .Name , strings .ToLower (rs .Identifier .GroupKind .Kind ))
101+ sc .logger .Failuref (errMsg )
102+ errs = append (errs , errors .New (errMsg ))
97103 }
98104 }
99105
100- if coll .Error != nil || ctx .Err () == context .DeadlineExceeded {
106+ if len (errs ) > 0 {
107+ return errors .Join (errs ... )
108+ }
109+
110+ if coll .Error != nil || errors .Is (ctx .Err (), context .DeadlineExceeded ) {
101111 return fmt .Errorf ("timed out waiting for all resources to be ready" )
102112 }
103113 return nil
0 commit comments