fix: enable error-nil and nil-compare rules from testifylint in module k8s.io/client-go

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

Kubernetes-commit: 71ced25f44dce83297388ca8ac0aa60afb93b009
This commit is contained in:
Matthieu MOREL 2024-09-27 07:28:52 +02:00 committed by Kubernetes Publisher
parent 2d7a47c42b
commit 84137c2466

View File

@ -19,12 +19,12 @@ package testing
import (
"fmt"
"math/rand"
"sigs.k8s.io/structured-merge-diff/v4/typed"
"strconv"
"sync"
"testing"
"github.com/stretchr/testify/assert"
"sigs.k8s.io/structured-merge-diff/v4/typed"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
@ -450,7 +450,7 @@ func TestGetWithExactMatch(t *testing.T) {
nodeResource := schema.GroupVersionResource{Group: "", Version: "v1", Resource: "node"}
node, gvr := constructObject(nodeResource, "node", "")
assert.Nil(t, o.Add(node))
assert.NoError(t, o.Add(node))
// Exact match
_, err = o.Get(gvr, "", "node")
@ -466,7 +466,7 @@ func TestGetWithExactMatch(t *testing.T) {
o = NewObjectTracker(scheme, codecs.UniversalDecoder())
podResource := schema.GroupVersionResource{Group: "", Version: "v1", Resource: "pod"}
pod, gvr := constructObject(podResource, "pod", "default")
assert.Nil(t, o.Add(pod))
assert.NoError(t, o.Add(pod))
// Exact match
_, err = o.Get(gvr, "default", "pod")