From e9211d3279649795e40d9698f05e9752d111024a Mon Sep 17 00:00:00 2001 From: brianpursley Date: Tue, 25 Jan 2022 20:31:47 -0500 Subject: [PATCH] Fix wrong status code in unit test error messages. Replace deprecated use of diff.ObjectReflectDiff() with cmp.Diff(). --- .../k8s.io/apiserver/pkg/server/filters/timeout_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/staging/src/k8s.io/apiserver/pkg/server/filters/timeout_test.go b/staging/src/k8s.io/apiserver/pkg/server/filters/timeout_test.go index 1bca00f2dbc..dd18167a08d 100644 --- a/staging/src/k8s.io/apiserver/pkg/server/filters/timeout_test.go +++ b/staging/src/k8s.io/apiserver/pkg/server/filters/timeout_test.go @@ -36,12 +36,12 @@ import ( "testing" "time" + "github.com/google/go-cmp/cmp" "golang.org/x/net/http2" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/util/diff" "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apiserver/pkg/endpoints/request" @@ -143,7 +143,7 @@ func TestTimeout(t *testing.T) { t.Fatal(err) } if res.StatusCode != http.StatusGatewayTimeout { - t.Errorf("got res.StatusCode %d; expected %d", res.StatusCode, http.StatusServiceUnavailable) + t.Errorf("got res.StatusCode %d; expected %d", res.StatusCode, http.StatusGatewayTimeout) } body, _ = ioutil.ReadAll(res.Body) status := &metav1.Status{} @@ -151,7 +151,7 @@ func TestTimeout(t *testing.T) { t.Fatal(err) } if !reflect.DeepEqual(status, &timeoutErr.ErrStatus) { - t.Errorf("unexpected object: %s", diff.ObjectReflectDiff(&timeoutErr.ErrStatus, status)) + t.Errorf("unexpected object: %s", cmp.Diff(&timeoutErr.ErrStatus, status)) } if record.Count() != 1 { t.Errorf("did not invoke record method: %#v", record) @@ -244,7 +244,7 @@ func TestTimeoutHeaders(t *testing.T) { t.Fatal(err) } if res.StatusCode != http.StatusGatewayTimeout { - t.Errorf("got res.StatusCode %d; expected %d", res.StatusCode, http.StatusServiceUnavailable) + t.Errorf("got res.StatusCode %d; expected %d", res.StatusCode, http.StatusGatewayTimeout) } res.Body.Close() }