From dc2716eef273dae4f8b6d55fa33624502f6d5a0e Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Wed, 13 Nov 2024 12:44:36 +0100 Subject: [PATCH] Fix cinder controller server tests --- pkg/csi/cinder/controllerserver_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/csi/cinder/controllerserver_test.go b/pkg/csi/cinder/controllerserver_test.go index f8d7bcd541..654d5c0033 100644 --- a/pkg/csi/cinder/controllerserver_test.go +++ b/pkg/csi/cinder/controllerserver_test.go @@ -46,6 +46,7 @@ func TestCreateVolume(t *testing.T) { properties := map[string]string{"cinder.csi.openstack.org/cluster": FakeCluster} // CreateVolume(name string, size int, vtype, availability string, snapshotID string, sourceVolID string, sourceBackupID string, tags map[string]string) (string, string, int, error) osmock.On("CreateVolume", FakeVolName, mock.AnythingOfType("int"), FakeVolType, FakeAvailability, "", "", "", properties).Return(&FakeVol, nil) + osmock.On("WaitVolumeTargetStatusWithCustomBackoff", FakeVol.ID, []string{openstack.VolumeAvailableStatus}, mock.AnythingOfType("*wait.Backoff")).Return(nil) osmock.On("GetVolumesByName", FakeVolName).Return(FakeVolListEmpty, nil) // Init assert @@ -93,6 +94,7 @@ func TestCreateVolumeWithParam(t *testing.T) { // CreateVolume(name string, size int, vtype, availability string, snapshotID string, sourceVolID string, sourceBackupID string, tags map[string]string) (string, string, int, error) // Vol type and availability comes from CreateVolumeRequest.Parameters osmock.On("CreateVolume", FakeVolName, mock.AnythingOfType("int"), "dummyVolType", "cinder", "", "", "", properties).Return(&FakeVol, nil) + osmock.On("WaitVolumeTargetStatusWithCustomBackoff", FakeVol.ID, []string{openstack.VolumeAvailableStatus}, mock.AnythingOfType("*wait.Backoff")).Return(nil) osmock.On("GetVolumesByName", FakeVolName).Return(FakeVolListEmpty, nil) // Init assert @@ -148,6 +150,7 @@ func TestCreateVolumeWithExtraMetadata(t *testing.T) { } // CreateVolume(name string, size int, vtype, availability string, snapshotID string, sourceVolID string, sourceBackupID string, tags map[string]string) (string, string, int, error) osmock.On("CreateVolume", FakeVolName, mock.AnythingOfType("int"), FakeVolType, FakeAvailability, "", "", "", properties).Return(&FakeVol, nil) + osmock.On("WaitVolumeTargetStatusWithCustomBackoff", FakeVol.ID, []string{openstack.VolumeAvailableStatus}, mock.AnythingOfType("*wait.Backoff")).Return(nil) osmock.On("GetVolumesByName", FakeVolName).Return(FakeVolListEmpty, nil) @@ -188,6 +191,7 @@ func TestCreateVolumeFromSnapshot(t *testing.T) { properties := map[string]string{"cinder.csi.openstack.org/cluster": FakeCluster} // CreateVolume(name string, size int, vtype, availability string, snapshotID string, sourceVolID string, sourceBackupID string, tags map[string]string) (string, string, int, error) osmock.On("CreateVolume", FakeVolName, mock.AnythingOfType("int"), FakeVolType, "", FakeSnapshotID, "", "", properties).Return(&FakeVolFromSnapshot, nil) + osmock.On("WaitVolumeTargetStatusWithCustomBackoff", FakeVolFromSnapshot.ID, []string{openstack.VolumeAvailableStatus}, mock.AnythingOfType("*wait.Backoff")).Return(nil) osmock.On("GetVolumesByName", FakeVolName).Return(FakeVolListEmpty, nil) // Init assert @@ -235,6 +239,7 @@ func TestCreateVolumeFromSourceVolume(t *testing.T) { properties := map[string]string{"cinder.csi.openstack.org/cluster": FakeCluster} // CreateVolume(name string, size int, vtype, availability string, snapshotID string, sourceVolID string, sourceBackupID string, tags map[string]string) (string, string, int, error) osmock.On("CreateVolume", FakeVolName, mock.AnythingOfType("int"), FakeVolType, "", "", FakeVolID, "", properties).Return(&FakeVolFromSourceVolume, nil) + osmock.On("WaitVolumeTargetStatusWithCustomBackoff", FakeVolFromSourceVolume.ID, []string{openstack.VolumeAvailableStatus}, mock.AnythingOfType("*wait.Backoff")).Return(nil) osmock.On("GetVolumesByName", FakeVolName).Return(FakeVolListEmpty, nil) // Init assert