@@ -22,6 +22,7 @@ import (
2222 "context"
2323 "fmt"
2424 "reflect"
25+ "strings"
2526 "testing"
2627 "time"
2728
@@ -131,19 +132,21 @@ func InferencePoolMustHaveCondition(t *testing.T, c client.Reader, poolNN types.
131132 if len (lastObservedPool .Status .Parents ) == 0 {
132133 debugMsg += " (No parent statuses reported)"
133134 }
135+ builder := strings.Builder {}
134136 for i , parentStatus := range lastObservedPool .Status .Parents {
135137 namespace := parentStatus .ParentRef .Namespace
136138 if namespace == "" {
137139 namespace = inferenceapi .Namespace (poolNN .Namespace ) // Fallback to the pool's namespace
138140 }
139- debugMsg += fmt .Sprintf ( "\n Parent %d (Gateway: %s/%s):" , i , namespace , parentStatus .ParentRef .Name )
141+ fmt .Fprintf ( & builder , "\n Parent %d (Gateway: %s/%s):" , i , namespace , parentStatus .ParentRef .Name )
140142 if len (parentStatus .Conditions ) == 0 {
141- debugMsg += " (No conditions reported for this parent)"
143+ builder . WriteString ( " (No conditions reported for this parent)" )
142144 }
143145 for _ , cond := range parentStatus .Conditions {
144- debugMsg += fmt .Sprintf ( "\n - Type: %s, Status: %s, Reason: %s, Message: %s" , cond .Type , cond .Status , cond .Reason , cond .Message )
146+ fmt .Fprintf ( & builder , "\n - Type: %s, Status: %s, Reason: %s, Message: %s" , cond .Type , cond .Status , cond .Reason , cond .Message )
145147 }
146148 }
149+ debugMsg += builder .String ()
147150 } else if lastError == nil || ! apierrors .IsNotFound (lastError ) {
148151 debugMsg += "\n InferencePool was not found or not observed successfully during polling."
149152 }
0 commit comments