Skip to content

Commit

Permalink
🌱 Improve E2E error reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
EduardGomezEscandell committed Nov 14, 2023
1 parent 8fed1e6 commit 0117243
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions end-to-end/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 0117243

Please sign in to comment.