@@ -160,9 +160,10 @@ func DeploymentPodIsRunningMustNotChangeWithin(d time.Duration, namespace, name
160160 if err := wait .For (conditions .New (c .Client ().Resources ()).PodConditionMatch (pod , corev1 .PodReady , corev1 .ConditionFalse ), wait .WithTimeout (d ), wait .WithInterval (DefaultPollInterval )); err != nil {
161161 if deadlineExceed (err ) {
162162 t .Logf ("Deployment %s/%s had running pod that did not change after %s" , dp .GetNamespace (), dp .GetName (), since (start ))
163- } else {
164- t .Errorf ("Error while observing pod for deployment %s/%s" , dp .GetNamespace (), dp .GetName ())
163+ return ctx
165164 }
165+
166+ t .Errorf ("Error while observing pod for deployment %s/%s" , dp .GetNamespace (), dp .GetName ())
166167 return ctx
167168 }
168169 t .Errorf ("Deployment %s/%s had pod that changed within %s, but it should not have" , dp .GetNamespace (), dp .GetName (), d .String ())
@@ -208,15 +209,16 @@ func checkArgSetWithin(d time.Duration, arg string, wantSet bool, namespace, nam
208209 }
209210 }
210211
211- if wantSet && ! found {
212+ switch {
213+ case wantSet && ! found :
212214 t .Logf ("did not find arg %s within %s" , arg , c .Args )
213215 return false , nil
214- } else if ! wantSet && found {
216+ case ! wantSet && found :
215217 t .Logf ("unexpectedly found arg %s within %s" , arg , c .Args )
216218 return false , nil
219+ default :
220+ return true , nil
217221 }
218-
219- return true , nil
220222 }, wait .WithTimeout (d ), wait .WithInterval (DefaultPollInterval )); err != nil {
221223 t .Fatal (err )
222224 return ctx
@@ -691,9 +693,10 @@ func ClaimUnderTestMustNotChangeWithin(d time.Duration) features.Func {
691693 if err := wait .For (conditions .New (c .Client ().Resources ()).ResourcesMatch (list , m ), wait .WithTimeout (d )); err != nil {
692694 if deadlineExceed (err ) {
693695 t .Logf ("Claim %s did not change within %s" , identifier (cm ), d .String ())
694- } else {
695- t .Errorf ("Error while observing claim %s: %v" , identifier (cm ), err )
696+ return ctx
696697 }
698+
699+ t .Errorf ("Error while observing claim %s: %v" , identifier (cm ), err )
697700 return ctx
698701 }
699702 t .Errorf ("Claim %s changed within %s, but it should not have" , identifier (cm ), d .String ())
@@ -738,9 +741,10 @@ func CompositeUnderTestMustNotChangeWithin(d time.Duration) features.Func {
738741 if err := wait .For (conditions .New (c .Client ().Resources ()).ResourcesMatch (list , m ), wait .WithTimeout (d )); err != nil {
739742 if deadlineExceed (err ) {
740743 t .Logf ("Composite resource %s did not change within %s" , identifier (cp ), d .String ())
741- } else {
742- t .Errorf ("Error while observing composite resource %s: %v" , identifier (cp ), err )
744+ return ctx
743745 }
746+
747+ t .Errorf ("Error while observing composite resource %s: %v" , identifier (cp ), err )
744748 return ctx
745749 }
746750 t .Errorf ("Composite resource %s changed within %s, but it should not have" , identifier (cp ), d .String ())
0 commit comments