From d1fb0b57dfdc372ba0fbe053aeb2e3fd98263c54 Mon Sep 17 00:00:00 2001 From: Hemant Kumar Date: Wed, 18 Dec 2019 17:57:23 -0500 Subject: [PATCH] Expect NodeUnpublish calls when NodePublish is called While this is looser check than original check, I do not think we can quite expect NodePublish and NodeUnpublish call counts to match NodePublishvolume call count may not be same as NodeUnpublishVolume call count because reconciler may have a mount operation queued up while previous one is finishing. So, it is not unusual to have more than one NodePublishVolume call for same pod+volume combination, similarly unmount may also run more than once. --- test/e2e/storage/csi_mock_volume.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/e2e/storage/csi_mock_volume.go b/test/e2e/storage/csi_mock_volume.go index e71c3e562b4..963e836d019 100644 --- a/test/e2e/storage/csi_mock_volume.go +++ b/test/e2e/storage/csi_mock_volume.go @@ -793,8 +793,12 @@ func checkPodLogs(cs clientset.Interface, namespace, driverPodName, driverContai if foundAttributes.Len() != 0 { return fmt.Errorf("some unexpected volume attributes were found: %+v", foundAttributes.List()) } - if numNodePublishVolume != numNodeUnpublishVolume { - return fmt.Errorf("number of NodePublishVolume %d != number of NodeUnpublishVolume %d", numNodePublishVolume, numNodeUnpublishVolume) + if numNodePublishVolume == 0 { + return fmt.Errorf("NodePublish was never called") + } + + if numNodeUnpublishVolume == 0 { + return fmt.Errorf("NodeUnpublish was never called") } return nil }