mirror of
https://github.com/gravitational/teleport
synced 2024-10-19 08:43:58 +00:00
improve ControlMaster error reporting (#30631)
This commit is contained in:
parent
d5c27ea086
commit
37e18d94b6
|
@ -4463,15 +4463,12 @@ func testExternalClient(t *testing.T, suite *integrationTestSuite) {
|
|||
if tt.outError {
|
||||
require.Error(t, err)
|
||||
} else {
|
||||
if err != nil {
|
||||
// If an *exec.ExitError is returned, parse it and return stderr. If this
|
||||
// is not done then c.Assert will just print a byte array for the error.
|
||||
er, ok := err.(*exec.ExitError)
|
||||
if ok {
|
||||
t.Fatalf("Unexpected error: %v", string(er.Stderr))
|
||||
}
|
||||
// ensure stderr is printed as a string rather than bytes
|
||||
var stderr string
|
||||
if e, ok := err.(*exec.ExitError); ok {
|
||||
stderr = string(e.Stderr)
|
||||
}
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, err, "stderr=%q", stderr)
|
||||
require.Equal(t, tt.outExecOutput, strings.TrimSpace(string(output)))
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue