fix require-error rule from testifylint

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
This commit is contained in:
Matthieu MOREL
2025-06-01 21:44:09 +02:00
parent 3024e6223e
commit 07ea14962c
99 changed files with 483 additions and 440 deletions

View File

@@ -22,6 +22,7 @@ import (
"github.com/pkg/errors"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
appsv1api "k8s.io/api/apps/v1"
corev1api "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -232,7 +233,7 @@ func TestGetPodSpec(t *testing.T) {
spec, err := GetPodSpec(context.TODO(), fakeKubeClient, test.namespace, kube.NodeOSLinux)
if test.expectErr == "" {
assert.NoError(t, err)
require.NoError(t, err)
assert.Equal(t, *spec, test.expectSpec)
} else {
assert.EqualError(t, err, test.expectErr)
@@ -317,7 +318,7 @@ func TestGetConfigs(t *testing.T) {
result, err := GetConfigs(context.TODO(), test.namespace, fakeKubeClient, "node-agent-config")
if test.expectErr == "" {
assert.NoError(t, err)
require.NoError(t, err)
if test.expectResult == nil {
assert.Nil(t, result)
@@ -453,7 +454,7 @@ func TestGetLabelValue(t *testing.T) {
value, err := GetLabelValue(context.TODO(), fakeKubeClient, test.namespace, "fake-label", kube.NodeOSLinux)
if test.expectErr == "" {
assert.NoError(t, err)
require.NoError(t, err)
assert.Equal(t, test.expectedValue, value)
} else {
assert.EqualError(t, err, test.expectErr)
@@ -582,7 +583,7 @@ func TestGetAnnotationValue(t *testing.T) {
value, err := GetAnnotationValue(context.TODO(), fakeKubeClient, test.namespace, "fake-annotation", kube.NodeOSLinux)
if test.expectErr == "" {
assert.NoError(t, err)
require.NoError(t, err)
assert.Equal(t, test.expectedValue, value)
} else {
assert.EqualError(t, err, test.expectErr)
@@ -743,7 +744,7 @@ func TestGetHostPodPath(t *testing.T) {
path, err := GetHostPodPath(context.TODO(), fakeKubeClient, test.namespace, test.osType)
if test.expectErr == "" {
assert.NoError(t, err)
require.NoError(t, err)
assert.Equal(t, test.expectedValue, path)
} else {
assert.EqualError(t, err, test.expectErr)