mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 14:37:00 +00:00
Merge pull request #127680 from mmorel-35/testifylint/nil-compare@k8s.io/cri-client
fix: enable error-nil and nil-compare rules from testifylint in module `k8s.io/cri-client`
This commit is contained in:
commit
d2ec60df3b
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user