From 770d5ce054762bd73567d9166cccc24772f764d7 Mon Sep 17 00:00:00 2001 From: Medya Ghazizadeh Date: Wed, 13 Aug 2025 11:27:44 -0700 Subject: [PATCH] test fix post-mortem not showing (#21328) --- test/integration/helpers_test.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/integration/helpers_test.go b/test/integration/helpers_test.go index be7bdff099..d003f5be56 100644 --- a/test/integration/helpers_test.go +++ b/test/integration/helpers_test.go @@ -435,6 +435,7 @@ func VolumeSnapshotWait(ctx context.Context, t *testing.T, profile string, ns st } // Status returns a minikube component status as a string +// If the command outputs multiple lines, only the first line is returned to avoid https://github.com/kubernetes/minikube/issues/21326 func Status(ctx context.Context, t *testing.T, path string, profile string, key string, node string) string { t.Helper() // Reminder of useful keys: "Host", "Kubelet", "APIServer" @@ -442,7 +443,15 @@ func Status(ctx context.Context, t *testing.T, path string, profile string, key if err != nil { t.Logf("status error: %v (may be ok)", err) } - return strings.TrimSpace(rr.Stdout.String()) + out := strings.TrimSpace(rr.Stdout.String()) + if out == "" { + return out + } + // Take only the first line if multi-line (ignore warnings or extra notes) + if idx := strings.IndexByte(out, '\n'); idx >= 0 { + out = out[:idx] + } + return strings.TrimSpace(out) } // showPodLogs logs debug info for pods