Skip to content

Commit

Permalink
Fix cinder controller server tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelEischer authored and robinschneider committed Dec 2, 2024
1 parent 66ff335 commit 9993e65
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/csi/cinder/controllerserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,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
Expand Down Expand Up @@ -103,6 +104,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
Expand Down Expand Up @@ -158,6 +160,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)

Expand Down Expand Up @@ -198,6 +201,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
Expand Down Expand Up @@ -245,6 +249,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
Expand Down

0 comments on commit 9993e65

Please sign in to comment.