mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 16:29:21 +00:00
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:
parent
a8c955ab42
commit
ab9f9ac951
@ -62,10 +62,10 @@ func TestParseEndpoint(t *testing.T) {
|
|||||||
protocol, addr, err := parseEndpoint(test.endpoint)
|
protocol, addr, err := parseEndpoint(test.endpoint)
|
||||||
assert.Equal(t, test.expectedProtocol, protocol)
|
assert.Equal(t, test.expectedProtocol, protocol)
|
||||||
if test.expectError {
|
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
|
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)
|
assert.Equal(t, test.expectedAddr, addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,10 +109,10 @@ func TestGetAddressAndDialer(t *testing.T) {
|
|||||||
// just test addr and err
|
// just test addr and err
|
||||||
addr, _, err := GetAddressAndDialer(test.endpoint)
|
addr, _, err := GetAddressAndDialer(test.endpoint)
|
||||||
if test.expectError {
|
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
|
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)
|
assert.Equal(t, test.expectedAddr, addr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ func TestVerifySandboxStatus(t *testing.T) {
|
|||||||
if actual != nil {
|
if actual != nil {
|
||||||
assert.EqualError(t, actual, status.expected.Error())
|
assert.EqualError(t, actual, status.expected.Error())
|
||||||
} else {
|
} else {
|
||||||
assert.Nil(t, status.expected)
|
assert.NoError(t, status.expected)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -175,7 +175,7 @@ func TestVerifyContainerStatus(t *testing.T) {
|
|||||||
if actual != nil {
|
if actual != nil {
|
||||||
assert.EqualError(t, actual, status.expected.Error())
|
assert.EqualError(t, actual, status.expected.Error())
|
||||||
} else {
|
} else {
|
||||||
assert.Nil(t, status.expected)
|
assert.NoError(t, status.expected)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user