Skip to content

Commit 7e578bd

Browse files
committed
lint
Signed-off-by: Omer Aplatony <[email protected]>
1 parent ed7f7ce commit 7e578bd

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

staging/src/k8s.io/apiextensions-apiserver/test/integration/validation_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,8 @@ func TestCRValidationOnCRDUpdate(t *testing.T) {
780780
// CR is now accepted
781781
err = wait.PollUntilContextTimeout(context.Background(), 500*time.Millisecond, wait.ForeverTestTimeout, true, func(ctx context.Context) (done bool, err error) {
782782
_, createErr := noxuResourceClient.Create(ctx, instanceToCreate, metav1.CreateOptions{})
783-
if _, isStatus := createErr.(*apierrors.StatusError); isStatus {
783+
var statusErr *apierrors.StatusError
784+
if errors.As(createErr, &statusErr) {
784785
if apierrors.IsInvalid(createErr) {
785786
return false, nil
786787
}

staging/src/k8s.io/apiextensions-apiserver/test/integration/versioning_test.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@ package integration
1818

1919
import (
2020
"context"
21+
stderrors "errors"
2122
"fmt"
2223
"net/http"
2324
"reflect"
2425
"testing"
2526
"time"
2627

2728
"github.com/stretchr/testify/assert"
29+
"github.com/stretchr/testify/require"
2830
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
2931
"k8s.io/apiextensions-apiserver/test/integration/fixtures"
3032
"k8s.io/apimachinery/pkg/api/errors"
@@ -96,7 +98,8 @@ func TestInternalVersionIsHandlerVersion(t *testing.T) {
9698
if patchErr != nil {
9799
// work around "grpc: the client connection is closing" error
98100
// TODO: fix the grpc error
99-
if statusErr, ok := patchErr.(*errors.StatusError); ok && statusErr.Status().Code == http.StatusInternalServerError {
101+
var statusErr *errors.StatusError
102+
if stderrors.As(patchErr, &statusErr) && statusErr.Status().Code == http.StatusInternalServerError {
100103
return false, nil
101104
}
102105
return false, patchErr
@@ -116,11 +119,12 @@ func TestInternalVersionIsHandlerVersion(t *testing.T) {
116119
i++
117120

118121
_, patchErr := noxuNamespacedResourceClientV1beta2.Patch(ctx, "foo", types.MergePatchType, patch, metav1.PatchOptions{})
119-
assert.Error(t, patchErr)
122+
require.Error(t, patchErr)
120123

121124
// work around "grpc: the client connection is closing" error
122125
// TODO: fix the grpc error
123-
if statusErr, ok := patchErr.(*errors.StatusError); ok && statusErr.Status().Code == http.StatusInternalServerError {
126+
var statusErr *errors.StatusError
127+
if stderrors.As(patchErr, &statusErr) && statusErr.Status().Code == http.StatusInternalServerError {
124128
return false, nil
125129
}
126130

0 commit comments

Comments
 (0)