add missing alias of api errors under test
This commit is contained in:
@@ -22,7 +22,6 @@ import (
|
||||
"testing"
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
@@ -46,7 +45,7 @@ func TestMaxResourceSize(t *testing.T) {
|
||||
if err == nil {
|
||||
t.Fatalf("unexpected no error")
|
||||
}
|
||||
if !errors.IsRequestEntityTooLargeError(err) {
|
||||
if !apierrors.IsRequestEntityTooLargeError(err) {
|
||||
t.Errorf("expected requested entity too large err, got %v", err)
|
||||
|
||||
}
|
||||
@@ -69,7 +68,7 @@ func TestMaxResourceSize(t *testing.T) {
|
||||
if err == nil {
|
||||
t.Fatalf("unexpected no error")
|
||||
}
|
||||
if !errors.IsRequestEntityTooLargeError(err) {
|
||||
if !apierrors.IsRequestEntityTooLargeError(err) {
|
||||
t.Errorf("expected requested entity too large err, got %v", err)
|
||||
|
||||
}
|
||||
@@ -80,7 +79,7 @@ func TestMaxResourceSize(t *testing.T) {
|
||||
if err == nil {
|
||||
t.Fatalf("unexpected no error")
|
||||
}
|
||||
if !errors.IsRequestEntityTooLargeError(err) {
|
||||
if !apierrors.IsRequestEntityTooLargeError(err) {
|
||||
t.Errorf("expected requested entity too large err, got %v", err)
|
||||
|
||||
}
|
||||
@@ -89,7 +88,7 @@ func TestMaxResourceSize(t *testing.T) {
|
||||
patchBody := []byte(`[{"op":"add","path":"/foo","value":` + strings.Repeat("[", 3*1024*1024/2-100) + strings.Repeat("]", 3*1024*1024/2-100) + `}]`)
|
||||
err = rest.Patch(types.JSONPatchType).AbsPath(fmt.Sprintf("/api/v1/namespaces/default/secrets/test")).
|
||||
Body(patchBody).Do().Error()
|
||||
if err != nil && !errors.IsBadRequest(err) {
|
||||
if err != nil && !apierrors.IsBadRequest(err) {
|
||||
t.Errorf("expected success or bad request err, got %v", err)
|
||||
}
|
||||
})
|
||||
@@ -105,7 +104,7 @@ func TestMaxResourceSize(t *testing.T) {
|
||||
patchBody := []byte(`{"value":` + strings.Repeat("[", 3*1024*1024/2-100) + strings.Repeat("]", 3*1024*1024/2-100) + `}`)
|
||||
err = rest.Patch(types.MergePatchType).AbsPath(fmt.Sprintf("/api/v1/namespaces/default/secrets/test")).
|
||||
Body(patchBody).Do().Error()
|
||||
if err != nil && !errors.IsBadRequest(err) {
|
||||
if err != nil && !apierrors.IsBadRequest(err) {
|
||||
t.Errorf("expected success or bad request err, got %v", err)
|
||||
}
|
||||
})
|
||||
@@ -121,7 +120,7 @@ func TestMaxResourceSize(t *testing.T) {
|
||||
patchBody := []byte(`{"value":` + strings.Repeat("[", 3*1024*1024/2-100) + strings.Repeat("]", 3*1024*1024/2-100) + `}`)
|
||||
err = rest.Patch(types.StrategicMergePatchType).AbsPath(fmt.Sprintf("/api/v1/namespaces/default/secrets/test")).
|
||||
Body(patchBody).Do().Error()
|
||||
if err != nil && !errors.IsBadRequest(err) {
|
||||
if err != nil && !apierrors.IsBadRequest(err) {
|
||||
t.Errorf("expected success or bad request err, got %v", err)
|
||||
}
|
||||
})
|
||||
@@ -137,7 +136,7 @@ func TestMaxResourceSize(t *testing.T) {
|
||||
patchBody := []byte(`{"value":` + strings.Repeat("[", 3*1024*1024/2-100) + strings.Repeat("]", 3*1024*1024/2-100) + `}`)
|
||||
err = rest.Patch(types.ApplyPatchType).Param("fieldManager", "test").AbsPath(fmt.Sprintf("/api/v1/namespaces/default/secrets/test")).
|
||||
Body(patchBody).Do().Error()
|
||||
if err != nil && !errors.IsBadRequest(err) {
|
||||
if err != nil && !apierrors.IsBadRequest(err) {
|
||||
t.Errorf("expected success or bad request err, got %#v", err)
|
||||
}
|
||||
})
|
||||
@@ -155,7 +154,7 @@ func TestMaxResourceSize(t *testing.T) {
|
||||
if err == nil {
|
||||
t.Fatalf("unexpected no error")
|
||||
}
|
||||
if !errors.IsRequestEntityTooLargeError(err) {
|
||||
if !apierrors.IsRequestEntityTooLargeError(err) {
|
||||
t.Errorf("expected requested entity too large err, got %v", err)
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user