From 1d764952dad743d5ed7afd913218471aef2d3015 Mon Sep 17 00:00:00 2001 From: "mengjiao.liu" Date: Thu, 1 Apr 2021 15:18:07 +0800 Subject: [PATCH] Fix incorrect test code in pkg/volume/csi/csi_attacher_test.go file --- pkg/volume/csi/csi_attacher_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/volume/csi/csi_attacher_test.go b/pkg/volume/csi/csi_attacher_test.go index 37ae0417f4b..2634a219b51 100644 --- a/pkg/volume/csi/csi_attacher_test.go +++ b/pkg/volume/csi/csi_attacher_test.go @@ -754,7 +754,7 @@ func TestAttacherWaitForVolumeAttachment(t *testing.T) { if tc.shouldFail && err == nil { t.Error("expecting failure, but err is nil") } - if tc.initAttachErr != nil { + if tc.initAttachErr != nil && err != nil { if tc.initAttachErr.Message != err.Error() { t.Errorf("expecting error [%v], got [%v]", tc.initAttachErr.Message, err.Error()) } @@ -1268,7 +1268,7 @@ func TestAttacherMountDevice(t *testing.T) { } return } - if err == nil && tc.shouldFail { + if tc.shouldFail { t.Errorf("test should fail, but no error occurred") } @@ -1440,7 +1440,7 @@ func TestAttacherMountDeviceWithInline(t *testing.T) { } return } - if err == nil && tc.shouldFail { + if tc.shouldFail { t.Errorf("test should fail, but no error occurred") } @@ -1585,7 +1585,7 @@ func TestAttacherUnmountDevice(t *testing.T) { } return } - if err == nil && tc.shouldFail { + if tc.shouldFail { t.Errorf("test should fail, but no error occurred") }