From d964569e1ec8dca001ccf1d5ab23c468a26a8883 Mon Sep 17 00:00:00 2001 From: Kenichi Omichi Date: Thu, 25 Jun 2020 04:46:44 +0000 Subject: [PATCH] nit: Fix invokeStaleDummyVMTestWithStoragePolicy() There were nits in invokeStaleDummyVMTestWithStoragePolicy() like - The error message didn't contain necessary space - IsVMPresent() can return an error, but lack of the error handling - IsVMPresent() returns true/false, but didn't use ExpectEqual() and less code readability This fixes those things. --- test/e2e/storage/vsphere/vsphere_volume_vsan_policy.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/e2e/storage/vsphere/vsphere_volume_vsan_policy.go b/test/e2e/storage/vsphere/vsphere_volume_vsan_policy.go index f13d4548e53..ee2bef7ec84 100644 --- a/test/e2e/storage/vsphere/vsphere_volume_vsan_policy.go +++ b/test/e2e/storage/vsphere/vsphere_volume_vsan_policy.go @@ -335,8 +335,9 @@ func invokeStaleDummyVMTestWithStoragePolicy(client clientset.Interface, masterN fnvHash := fnv.New32a() fnvHash.Write([]byte(vmName)) dummyVMFullName := dummyVMPrefixName + "-" + fmt.Sprint(fnvHash.Sum32()) - errorMsg := "Dummy VM - " + vmName + "is still present. Failing the test.." + errorMsg := "Dummy VM - " + vmName + " is still present. Failing the test.." nodeInfo := TestContext.NodeMapper.GetNodeInfo(masterNode) - isVMPresentFlag, _ := nodeInfo.VSphere.IsVMPresent(dummyVMFullName, nodeInfo.DataCenterRef) - framework.ExpectNotEqual(isVMPresentFlag, true, errorMsg) + isVMPresentFlag, err := nodeInfo.VSphere.IsVMPresent(dummyVMFullName, nodeInfo.DataCenterRef) + framework.ExpectNoError(err) + framework.ExpectEqual(isVMPresentFlag, false, errorMsg) }