@@ -18,13 +18,15 @@ package integration
18
18
19
19
import (
20
20
"context"
21
+ stderrors "errors"
21
22
"fmt"
22
23
"net/http"
23
24
"reflect"
24
25
"testing"
25
26
"time"
26
27
27
28
"github.com/stretchr/testify/assert"
29
+ "github.com/stretchr/testify/require"
28
30
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
29
31
"k8s.io/apiextensions-apiserver/test/integration/fixtures"
30
32
"k8s.io/apimachinery/pkg/api/errors"
@@ -96,7 +98,8 @@ func TestInternalVersionIsHandlerVersion(t *testing.T) {
96
98
if patchErr != nil {
97
99
// work around "grpc: the client connection is closing" error
98
100
// 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 {
100
103
return false , nil
101
104
}
102
105
return false , patchErr
@@ -116,11 +119,12 @@ func TestInternalVersionIsHandlerVersion(t *testing.T) {
116
119
i ++
117
120
118
121
_ , patchErr := noxuNamespacedResourceClientV1beta2 .Patch (ctx , "foo" , types .MergePatchType , patch , metav1.PatchOptions {})
119
- assert .Error (t , patchErr )
122
+ require .Error (t , patchErr )
120
123
121
124
// work around "grpc: the client connection is closing" error
122
125
// 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 {
124
128
return false , nil
125
129
}
126
130
0 commit comments