mirror of
https://github.com/kubernetes/client-go.git
synced 2025-06-27 15:39:39 +00:00
fixes the unit tests to be more tolerant with error messages
Kubernetes-commit: 98948ad8092b41ebc08d50aa557b2d7ba5496e7d
This commit is contained in:
parent
0d3f257a17
commit
cb8d3d1111
@ -18,6 +18,7 @@ package remotecommand
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -36,7 +37,7 @@ func TestV4ErrorDecoder(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
message: "{",
|
message: "{",
|
||||||
err: "error stream protocol error: unexpected end of JSON input in \"{\"",
|
err: "unexpected end of JSON input in \"{\"",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
message: `{"status": "Success" }`,
|
message: `{"status": "Success" }`,
|
||||||
@ -64,7 +65,7 @@ func TestV4ErrorDecoder(t *testing.T) {
|
|||||||
if want == "" {
|
if want == "" {
|
||||||
want = "<nil>"
|
want = "<nil>"
|
||||||
}
|
}
|
||||||
if got := fmt.Sprintf("%v", err); got != want {
|
if got := fmt.Sprintf("%v", err); !strings.Contains(got, want) {
|
||||||
t.Errorf("wrong error for message %q: want=%q, got=%q", test.message, want, got)
|
t.Errorf("wrong error for message %q: want=%q, got=%q", test.message, want, got)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user