mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Fix wrong status code in unit test error messages.
Replace deprecated use of diff.ObjectReflectDiff() with cmp.Diff().
This commit is contained in:
parent
6e25590494
commit
e9211d3279
@ -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()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user