From cb8d3d1111fab963b9af561027ca25b0a93b2e37 Mon Sep 17 00:00:00 2001 From: Rajalakshmi-Girish Date: Fri, 27 Nov 2020 08:21:56 +0000 Subject: [PATCH] fixes the unit tests to be more tolerant with error messages Kubernetes-commit: 98948ad8092b41ebc08d50aa557b2d7ba5496e7d --- tools/remotecommand/v4_test.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/remotecommand/v4_test.go b/tools/remotecommand/v4_test.go index b8674918..21799541 100644 --- a/tools/remotecommand/v4_test.go +++ b/tools/remotecommand/v4_test.go @@ -18,6 +18,7 @@ package remotecommand import ( "fmt" + "strings" "testing" ) @@ -36,7 +37,7 @@ func TestV4ErrorDecoder(t *testing.T) { }, { message: "{", - err: "error stream protocol error: unexpected end of JSON input in \"{\"", + err: "unexpected end of JSON input in \"{\"", }, { message: `{"status": "Success" }`, @@ -64,7 +65,7 @@ func TestV4ErrorDecoder(t *testing.T) { if want == "" { want = "" } - 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) } }