Skip to content

Commit 9993e65

Browse files
MichaelEischerrobinschneider
authored andcommitted
Fix cinder controller server tests
1 parent 66ff335 commit 9993e65

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pkg/csi/cinder/controllerserver_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ func TestCreateVolume(t *testing.T) {
5656
properties := map[string]string{"cinder.csi.openstack.org/cluster": FakeCluster}
5757
// CreateVolume(name string, size int, vtype, availability string, snapshotID string, sourceVolID string, sourceBackupID string, tags map[string]string) (string, string, int, error)
5858
osmock.On("CreateVolume", FakeVolName, mock.AnythingOfType("int"), FakeVolType, FakeAvailability, "", "", "", properties).Return(&FakeVol, nil)
59+
osmock.On("WaitVolumeTargetStatusWithCustomBackoff", FakeVol.ID, []string{openstack.VolumeAvailableStatus}, mock.AnythingOfType("*wait.Backoff")).Return(nil)
5960

6061
osmock.On("GetVolumesByName", FakeVolName).Return(FakeVolListEmpty, nil)
6162
// Init assert
@@ -103,6 +104,7 @@ func TestCreateVolumeWithParam(t *testing.T) {
103104
// CreateVolume(name string, size int, vtype, availability string, snapshotID string, sourceVolID string, sourceBackupID string, tags map[string]string) (string, string, int, error)
104105
// Vol type and availability comes from CreateVolumeRequest.Parameters
105106
osmock.On("CreateVolume", FakeVolName, mock.AnythingOfType("int"), "dummyVolType", "cinder", "", "", "", properties).Return(&FakeVol, nil)
107+
osmock.On("WaitVolumeTargetStatusWithCustomBackoff", FakeVol.ID, []string{openstack.VolumeAvailableStatus}, mock.AnythingOfType("*wait.Backoff")).Return(nil)
106108

107109
osmock.On("GetVolumesByName", FakeVolName).Return(FakeVolListEmpty, nil)
108110
// Init assert
@@ -158,6 +160,7 @@ func TestCreateVolumeWithExtraMetadata(t *testing.T) {
158160
}
159161
// CreateVolume(name string, size int, vtype, availability string, snapshotID string, sourceVolID string, sourceBackupID string, tags map[string]string) (string, string, int, error)
160162
osmock.On("CreateVolume", FakeVolName, mock.AnythingOfType("int"), FakeVolType, FakeAvailability, "", "", "", properties).Return(&FakeVol, nil)
163+
osmock.On("WaitVolumeTargetStatusWithCustomBackoff", FakeVol.ID, []string{openstack.VolumeAvailableStatus}, mock.AnythingOfType("*wait.Backoff")).Return(nil)
161164

162165
osmock.On("GetVolumesByName", FakeVolName).Return(FakeVolListEmpty, nil)
163166

@@ -198,6 +201,7 @@ func TestCreateVolumeFromSnapshot(t *testing.T) {
198201
properties := map[string]string{"cinder.csi.openstack.org/cluster": FakeCluster}
199202
// CreateVolume(name string, size int, vtype, availability string, snapshotID string, sourceVolID string, sourceBackupID string, tags map[string]string) (string, string, int, error)
200203
osmock.On("CreateVolume", FakeVolName, mock.AnythingOfType("int"), FakeVolType, "", FakeSnapshotID, "", "", properties).Return(&FakeVolFromSnapshot, nil)
204+
osmock.On("WaitVolumeTargetStatusWithCustomBackoff", FakeVolFromSnapshot.ID, []string{openstack.VolumeAvailableStatus}, mock.AnythingOfType("*wait.Backoff")).Return(nil)
201205
osmock.On("GetVolumesByName", FakeVolName).Return(FakeVolListEmpty, nil)
202206

203207
// Init assert
@@ -245,6 +249,7 @@ func TestCreateVolumeFromSourceVolume(t *testing.T) {
245249
properties := map[string]string{"cinder.csi.openstack.org/cluster": FakeCluster}
246250
// CreateVolume(name string, size int, vtype, availability string, snapshotID string, sourceVolID string, sourceBackupID string, tags map[string]string) (string, string, int, error)
247251
osmock.On("CreateVolume", FakeVolName, mock.AnythingOfType("int"), FakeVolType, "", "", FakeVolID, "", properties).Return(&FakeVolFromSourceVolume, nil)
252+
osmock.On("WaitVolumeTargetStatusWithCustomBackoff", FakeVolFromSourceVolume.ID, []string{openstack.VolumeAvailableStatus}, mock.AnythingOfType("*wait.Backoff")).Return(nil)
248253
osmock.On("GetVolumesByName", FakeVolName).Return(FakeVolListEmpty, nil)
249254

250255
// Init assert

0 commit comments

Comments
 (0)