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 committed Nov 13, 2024
1 parent 6e8eacb commit dc2716e
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 @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit dc2716e

Please sign in to comment.