Skip to content

Commit 09d09be

Browse files
committed
fix empty rule from testifylint
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
1 parent e7fb865 commit 09d09be

9 files changed

Lines changed: 16 additions & 17 deletions

File tree

.golangci.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@ linters:
260260
testifylint:
261261
# TODO: enable them all
262262
disable:
263-
- empty # FIXME
264263
- equal-values # FIXME
265264
- float-compare
266265
- go-require

pkg/cmd/cli/nodeagent/server_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ func Test_getDataPathConfigs(t *testing.T) {
190190
s.getDataPathConfigs()
191191
assert.Equal(t, test.expectConfigs, s.dataPathConfigs)
192192
if test.expectLog == "" {
193-
assert.Equal(t, "", logBuffer)
193+
assert.Empty(t, logBuffer)
194194
} else {
195195
assert.Contains(t, logBuffer, test.expectLog)
196196
}
@@ -408,7 +408,7 @@ func Test_getDataPathConcurrentNum(t *testing.T) {
408408
num := s.getDataPathConcurrentNum(defaultNum)
409409
assert.Equal(t, test.expectNum, num)
410410
if test.expectLog == "" {
411-
assert.Equal(t, "", logBuffer)
411+
assert.Empty(t, logBuffer)
412412
} else {
413413
assert.Contains(t, logBuffer, test.expectLog)
414414
}

pkg/cmd/util/flag/accessors_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ func TestGetOptionalStringFlag(t *testing.T) {
1212

1313
// not specified
1414
cmd := &cobra.Command{}
15-
assert.Equal(t, "", GetOptionalStringFlag(cmd, flagName))
15+
assert.Empty(t, GetOptionalStringFlag(cmd, flagName))
1616

1717
// specified
1818
cmd.Flags().String(flagName, "value", "")

pkg/cmd/util/flag/enum_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func TestSetOfEnum(t *testing.T) {
2222

2323
func TestTypeOfEnum(t *testing.T) {
2424
enum := NewEnum("a", "a", "b", "c")
25-
assert.Equal(t, "", enum.Type())
25+
assert.Empty(t, enum.Type())
2626
}
2727

2828
func TestAllowedValuesOfEnum(t *testing.T) {

pkg/cmd/util/output/output_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func TestClearOutputFlagDefault(t *testing.T) {
3434
BindFlags(cmd.Flags())
3535
cmd.Flags().Set("output", "json")
3636
ClearOutputFlagDefault(cmd)
37-
assert.Equal(t, "", cmd.Flags().Lookup("output").Value.String())
37+
assert.Empty(t, cmd.Flags().Lookup("output").Value.String())
3838
}
3939

4040
func cmdWithFormat(use string, format string) *cobra.Command {

pkg/install/resources_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ func TestResources(t *testing.T) {
5454

5555
crb := ClusterRoleBinding(DefaultVeleroNamespace)
5656
// The CRB is a cluster-scoped resource
57-
assert.Equal(t, "", crb.ObjectMeta.Namespace)
57+
assert.Empty(t, crb.ObjectMeta.Namespace)
5858
assert.Equal(t, "velero", crb.ObjectMeta.Name)
5959
assert.Equal(t, "velero", crb.Subjects[0].Namespace)
6060

6161
customNamespaceCRB := ClusterRoleBinding("foo")
6262
// The CRB is a cluster-scoped resource
63-
assert.Equal(t, "", customNamespaceCRB.ObjectMeta.Namespace)
63+
assert.Empty(t, customNamespaceCRB.ObjectMeta.Namespace)
6464
assert.Equal(t, "velero-foo", customNamespaceCRB.ObjectMeta.Name)
6565
assert.Equal(t, "foo", customNamespaceCRB.Subjects[0].Namespace)
6666

pkg/repository/maintenance/maintenance_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -289,14 +289,14 @@ func TestGetResultFromJob(t *testing.T) {
289289
// test an error should be returned
290290
result, err := getResultFromJob(cli, job)
291291
assert.EqualError(t, err, "no pod found for job test-job")
292-
assert.Equal(t, "", result)
292+
assert.Empty(t, result)
293293

294294
cli = fake.NewClientBuilder().WithObjects(job, pod).Build()
295295

296296
// test an error should be returned
297297
result, err = getResultFromJob(cli, job)
298298
assert.EqualError(t, err, "no container statuses found for job test-job")
299-
assert.Equal(t, "", result)
299+
assert.Empty(t, result)
300300

301301
// Set a non-terminated container status to the pod
302302
pod.Status = corev1api.PodStatus{
@@ -311,7 +311,7 @@ func TestGetResultFromJob(t *testing.T) {
311311
cli = fake.NewClientBuilder().WithObjects(job, pod).Build()
312312
result, err = getResultFromJob(cli, job)
313313
assert.EqualError(t, err, "container for job test-job is not terminated")
314-
assert.Equal(t, "", result)
314+
assert.Empty(t, result)
315315

316316
// Set a terminated container status to the pod
317317
pod.Status = corev1api.PodStatus{
@@ -328,7 +328,7 @@ func TestGetResultFromJob(t *testing.T) {
328328
cli = fake.NewClientBuilder().WithObjects(job, pod).Build()
329329
result, err = getResultFromJob(cli, job)
330330
assert.NoError(t, err)
331-
assert.Equal(t, "", result)
331+
assert.Empty(t, result)
332332

333333
// Set a terminated container status with invalidate message to the pod
334334
pod.Status = corev1api.PodStatus{
@@ -346,7 +346,7 @@ func TestGetResultFromJob(t *testing.T) {
346346
cli = fake.NewClientBuilder().WithObjects(job, pod).Build()
347347
result, err = getResultFromJob(cli, job)
348348
assert.EqualError(t, err, "error to locate repo maintenance error indicator from termination message")
349-
assert.Equal(t, "", result)
349+
assert.Empty(t, result)
350350

351351
// Set a terminated container status with empty maintenance error to the pod
352352
pod.Status = corev1api.PodStatus{
@@ -364,7 +364,7 @@ func TestGetResultFromJob(t *testing.T) {
364364
cli = fake.NewClientBuilder().WithObjects(job, pod).Build()
365365
result, err = getResultFromJob(cli, job)
366366
assert.EqualError(t, err, "nothing after repo maintenance error indicator in termination message")
367-
assert.Equal(t, "", result)
367+
assert.Empty(t, result)
368368

369369
// Set a terminated container status with maintenance error to the pod
370370
pod.Status = corev1api.PodStatus{

pkg/repository/udmrepo/kopialib/lib_repo_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ func TestUpdateProgress(t *testing.T) {
937937
if len(tc.logMessage) > 0 {
938938
assert.Contains(t, logMessage, tc.logMessage)
939939
} else {
940-
assert.Equal(t, "", logMessage)
940+
assert.Empty(t, logMessage)
941941
}
942942
})
943943
}
@@ -1339,7 +1339,7 @@ func TestMaintainProgress(t *testing.T) {
13391339
if len(tc.logMessage) > 0 {
13401340
assert.Contains(t, logMessage, tc.logMessage)
13411341
} else {
1342-
assert.Equal(t, "", logMessage)
1342+
assert.Empty(t, logMessage)
13431343
}
13441344
})
13451345
}

pkg/restic/command_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626

2727
func TestRepoName(t *testing.T) {
2828
c := &Command{RepoIdentifier: ""}
29-
assert.Equal(t, "", c.RepoName())
29+
assert.Empty(t, c.RepoName())
3030

3131
c.RepoIdentifier = "s3:s3.amazonaws.com/bucket/prefix/repo"
3232
assert.Equal(t, "repo", c.RepoName())

0 commit comments

Comments
 (0)