mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #107770 from brianpursley/timeout-test-2
Fix wrong status code in unit test error messages and replace deprecated function call
This commit is contained in:
commit
36431ae396
@ -36,12 +36,12 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/google/go-cmp/cmp"
|
||||||
"golang.org/x/net/http2"
|
"golang.org/x/net/http2"
|
||||||
|
|
||||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
"k8s.io/apimachinery/pkg/util/diff"
|
|
||||||
"k8s.io/apimachinery/pkg/util/runtime"
|
"k8s.io/apimachinery/pkg/util/runtime"
|
||||||
"k8s.io/apimachinery/pkg/util/sets"
|
"k8s.io/apimachinery/pkg/util/sets"
|
||||||
"k8s.io/apiserver/pkg/endpoints/request"
|
"k8s.io/apiserver/pkg/endpoints/request"
|
||||||
@ -143,7 +143,7 @@ func TestTimeout(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if res.StatusCode != http.StatusGatewayTimeout {
|
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)
|
body, _ = ioutil.ReadAll(res.Body)
|
||||||
status := &metav1.Status{}
|
status := &metav1.Status{}
|
||||||
@ -151,7 +151,7 @@ func TestTimeout(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if !reflect.DeepEqual(status, &timeoutErr.ErrStatus) {
|
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 {
|
if record.Count() != 1 {
|
||||||
t.Errorf("did not invoke record method: %#v", record)
|
t.Errorf("did not invoke record method: %#v", record)
|
||||||
@ -250,7 +250,7 @@ func TestTimeoutHeaders(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if res.StatusCode != http.StatusGatewayTimeout {
|
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()
|
res.Body.Close()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user