Skip to content

Commit ab9f9ac

Browse files
committed
fix: enable error-nil and nil-compare rules from testifylint in module k8s.io/cri-client
Signed-off-by: Matthieu MOREL <[email protected]>
1 parent a8c955a commit ab9f9ac

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

staging/src/k8s.io/cri-client/pkg/util/util_unix_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ func TestParseEndpoint(t *testing.T) {
6262
protocol, addr, err := parseEndpoint(test.endpoint)
6363
assert.Equal(t, test.expectedProtocol, protocol)
6464
if test.expectError {
65-
assert.NotNil(t, err, "Expect error during parsing %q", test.endpoint)
65+
assert.Error(t, err, "Expect error during parsing %q", test.endpoint)
6666
continue
6767
}
68-
assert.Nil(t, err, "Expect no error during parsing %q", test.endpoint)
68+
assert.NoError(t, err, "Expect no error during parsing %q", test.endpoint)
6969
assert.Equal(t, test.expectedAddr, addr)
7070
}
7171

@@ -109,10 +109,10 @@ func TestGetAddressAndDialer(t *testing.T) {
109109
// just test addr and err
110110
addr, _, err := GetAddressAndDialer(test.endpoint)
111111
if test.expectError {
112-
assert.NotNil(t, err, "expected error during parsing %s", test.endpoint)
112+
assert.Error(t, err, "expected error during parsing %s", test.endpoint)
113113
continue
114114
}
115-
assert.Nil(t, err, "expected no error during parsing %s", test.endpoint)
115+
assert.NoError(t, err, "expected no error during parsing %s", test.endpoint)
116116
assert.Equal(t, test.expectedAddr, addr)
117117
}
118118
}

staging/src/k8s.io/cri-client/pkg/utils_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func TestVerifySandboxStatus(t *testing.T) {
102102
if actual != nil {
103103
assert.EqualError(t, actual, status.expected.Error())
104104
} else {
105-
assert.Nil(t, status.expected)
105+
assert.NoError(t, status.expected)
106106
}
107107
}
108108
}
@@ -175,7 +175,7 @@ func TestVerifyContainerStatus(t *testing.T) {
175175
if actual != nil {
176176
assert.EqualError(t, actual, status.expected.Error())
177177
} else {
178-
assert.Nil(t, status.expected)
178+
assert.NoError(t, status.expected)
179179
}
180180
}
181181
}

0 commit comments

Comments
 (0)