From 0117243f07be3b45af25d8b3466f51d12c12c3cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edu=20G=C3=B3mez=20Escandell?= Date: Wed, 8 Nov 2023 09:52:22 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=B1=20Improve=20E2E=20error=20reportin?= =?UTF-8?q?g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- end-to-end/utils_test.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/end-to-end/utils_test.go b/end-to-end/utils_test.go index c493711db..5043e5fc5 100644 --- a/end-to-end/utils_test.go +++ b/end-to-end/utils_test.go @@ -154,14 +154,20 @@ func stopAgent(ctx context.Context) error { func distroIsProAttached(t *testing.T, ctx context.Context, d gowsl.Distro) (bool, error) { t.Helper() - out, err := d.Command(ctx, "pro status --format=json").Output() - if err != nil { - return false, fmt.Errorf("could not call pro status: %v. %s", err, out) + var stdout, stderr bytes.Buffer + + cmd := d.Command(ctx, "pro status --format=json") + cmd.Stdout = &stdout + cmd.Stderr = &stderr + + if err := cmd.Run(); err != nil { + return false, fmt.Errorf("could not call pro status: %v.\nSTDOUT: %s\nSTDERR: %s", err, &stdout, &stderr) } var response struct { Attached bool } + out := stdout.Bytes() if err := json.Unmarshal(out, &response); err != nil { return false, fmt.Errorf("could not parse pro status response: %v: %s", err, out) }