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

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
This commit is contained in:
Matthieu MOREL 2024-09-27 07:28:14 +02:00
parent a8c955ab42
commit ab9f9ac951
2 changed files with 6 additions and 6 deletions

View File

@ -62,10 +62,10 @@ func TestParseEndpoint(t *testing.T) {
protocol, addr, err := parseEndpoint(test.endpoint)
assert.Equal(t, test.expectedProtocol, protocol)
if test.expectError {
assert.NotNil(t, err, "Expect error during parsing %q", test.endpoint)
assert.Error(t, err, "Expect error during parsing %q", test.endpoint)
continue
}
assert.Nil(t, err, "Expect no error during parsing %q", test.endpoint)
assert.NoError(t, err, "Expect no error during parsing %q", test.endpoint)
assert.Equal(t, test.expectedAddr, addr)
}
@ -109,10 +109,10 @@ func TestGetAddressAndDialer(t *testing.T) {
// just test addr and err
addr, _, err := GetAddressAndDialer(test.endpoint)
if test.expectError {
assert.NotNil(t, err, "expected error during parsing %s", test.endpoint)
assert.Error(t, err, "expected error during parsing %s", test.endpoint)
continue
}
assert.Nil(t, err, "expected no error during parsing %s", test.endpoint)
assert.NoError(t, err, "expected no error during parsing %s", test.endpoint)
assert.Equal(t, test.expectedAddr, addr)
}
}

View File

@ -102,7 +102,7 @@ func TestVerifySandboxStatus(t *testing.T) {
if actual != nil {
assert.EqualError(t, actual, status.expected.Error())
} else {
assert.Nil(t, status.expected)
assert.NoError(t, status.expected)
}
}
}
@ -175,7 +175,7 @@ func TestVerifyContainerStatus(t *testing.T) {
if actual != nil {
assert.EqualError(t, actual, status.expected.Error())
} else {
assert.Nil(t, status.expected)
assert.NoError(t, status.expected)
}
}
}