Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
Signed-off-by: Omer Aplatony <omerap12@gmail.com>
  • Loading branch information
omerap12 committed Dec 14, 2024
1 parent ed7f7ce commit 7e578bd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,8 @@ func TestCRValidationOnCRDUpdate(t *testing.T) {
// CR is now accepted
err = wait.PollUntilContextTimeout(context.Background(), 500*time.Millisecond, wait.ForeverTestTimeout, true, func(ctx context.Context) (done bool, err error) {
_, createErr := noxuResourceClient.Create(ctx, instanceToCreate, metav1.CreateOptions{})
if _, isStatus := createErr.(*apierrors.StatusError); isStatus {
var statusErr *apierrors.StatusError
if errors.As(createErr, &statusErr) {
if apierrors.IsInvalid(createErr) {
return false, nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ package integration

import (
"context"
stderrors "errors"
"fmt"
"net/http"
"reflect"
"testing"
"time"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
"k8s.io/apiextensions-apiserver/test/integration/fixtures"
"k8s.io/apimachinery/pkg/api/errors"
Expand Down Expand Up @@ -96,7 +98,8 @@ func TestInternalVersionIsHandlerVersion(t *testing.T) {
if patchErr != nil {
// work around "grpc: the client connection is closing" error
// TODO: fix the grpc error
if statusErr, ok := patchErr.(*errors.StatusError); ok && statusErr.Status().Code == http.StatusInternalServerError {
var statusErr *errors.StatusError
if stderrors.As(patchErr, &statusErr) && statusErr.Status().Code == http.StatusInternalServerError {
return false, nil
}
return false, patchErr
Expand All @@ -116,11 +119,12 @@ func TestInternalVersionIsHandlerVersion(t *testing.T) {
i++

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

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

Expand Down

0 comments on commit 7e578bd

Please sign in to comment.