WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit dc2716e

Browse files
Fix cinder controller server tests
1 parent 6e8eacb commit dc2716e

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
@@ -46,6 +46,7 @@ func TestCreateVolume(t *testing.T) {
4646
properties := map[string]string{"cinder.csi.openstack.org/cluster": FakeCluster}
4747
// CreateVolume(name string, size int, vtype, availability string, snapshotID string, sourceVolID string, sourceBackupID string, tags map[string]string) (string, string, int, error)
4848
osmock.On("CreateVolume", FakeVolName, mock.AnythingOfType("int"), FakeVolType, FakeAvailability, "", "", "", properties).Return(&FakeVol, nil)
49+
osmock.On("WaitVolumeTargetStatusWithCustomBackoff", FakeVol.ID, []string{openstack.VolumeAvailableStatus}, mock.AnythingOfType("*wait.Backoff")).Return(nil)
4950

5051
osmock.On("GetVolumesByName", FakeVolName).Return(FakeVolListEmpty, nil)
5152
// Init assert
@@ -93,6 +94,7 @@ func TestCreateVolumeWithParam(t *testing.T) {
9394
// CreateVolume(name string, size int, vtype, availability string, snapshotID string, sourceVolID string, sourceBackupID string, tags map[string]string) (string, string, int, error)
9495
// Vol type and availability comes from CreateVolumeRequest.Parameters
9596
osmock.On("CreateVolume", FakeVolName, mock.AnythingOfType("int"), "dummyVolType", "cinder", "", "", "", properties).Return(&FakeVol, nil)
97+
osmock.On("WaitVolumeTargetStatusWithCustomBackoff", FakeVol.ID, []string{openstack.VolumeAvailableStatus}, mock.AnythingOfType("*wait.Backoff")).Return(nil)
9698

9799
osmock.On("GetVolumesByName", FakeVolName).Return(FakeVolListEmpty, nil)
98100
// Init assert
@@ -148,6 +150,7 @@ func TestCreateVolumeWithExtraMetadata(t *testing.T) {
148150
}
149151
// CreateVolume(name string, size int, vtype, availability string, snapshotID string, sourceVolID string, sourceBackupID string, tags map[string]string) (string, string, int, error)
150152
osmock.On("CreateVolume", FakeVolName, mock.AnythingOfType("int"), FakeVolType, FakeAvailability, "", "", "", properties).Return(&FakeVol, nil)
153+
osmock.On("WaitVolumeTargetStatusWithCustomBackoff", FakeVol.ID, []string{openstack.VolumeAvailableStatus}, mock.AnythingOfType("*wait.Backoff")).Return(nil)
151154

152155
osmock.On("GetVolumesByName", FakeVolName).Return(FakeVolListEmpty, nil)
153156

@@ -188,6 +191,7 @@ func TestCreateVolumeFromSnapshot(t *testing.T) {
188191
properties := map[string]string{"cinder.csi.openstack.org/cluster": FakeCluster}
189192
// CreateVolume(name string, size int, vtype, availability string, snapshotID string, sourceVolID string, sourceBackupID string, tags map[string]string) (string, string, int, error)
190193
osmock.On("CreateVolume", FakeVolName, mock.AnythingOfType("int"), FakeVolType, "", FakeSnapshotID, "", "", properties).Return(&FakeVolFromSnapshot, nil)
194+
osmock.On("WaitVolumeTargetStatusWithCustomBackoff", FakeVolFromSnapshot.ID, []string{openstack.VolumeAvailableStatus}, mock.AnythingOfType("*wait.Backoff")).Return(nil)
191195
osmock.On("GetVolumesByName", FakeVolName).Return(FakeVolListEmpty, nil)
192196

193197
// Init assert
@@ -235,6 +239,7 @@ func TestCreateVolumeFromSourceVolume(t *testing.T) {
235239
properties := map[string]string{"cinder.csi.openstack.org/cluster": FakeCluster}
236240
// CreateVolume(name string, size int, vtype, availability string, snapshotID string, sourceVolID string, sourceBackupID string, tags map[string]string) (string, string, int, error)
237241
osmock.On("CreateVolume", FakeVolName, mock.AnythingOfType("int"), FakeVolType, "", "", FakeVolID, "", properties).Return(&FakeVolFromSourceVolume, nil)
242+
osmock.On("WaitVolumeTargetStatusWithCustomBackoff", FakeVolFromSourceVolume.ID, []string{openstack.VolumeAvailableStatus}, mock.AnythingOfType("*wait.Backoff")).Return(nil)
238243
osmock.On("GetVolumesByName", FakeVolName).Return(FakeVolListEmpty, nil)
239244

240245
// Init assert

0 commit comments

Comments
 (0)