Skip to content

Commit

Permalink
fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelEischer committed Feb 2, 2024
1 parent dd9f3df commit d34baf0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/csi/cinder/controllerserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func TestCreateVolume(t *testing.T) {
osmock.On("CreateVolume", FakeVolName, mock.AnythingOfType("int"), FakeVolType, FakeAvailability, "", "", &properties).Return(&FakeVol, nil)

osmock.On("GetVolumesByName", FakeVolName).Return(FakeVolListEmpty, nil)
osmock.On("WaitVolumeTargetStatusWithCustomBackoff", mock.Anything, mock.Anything, mock.Anything).Return(nil)
// Init assert
assert := assert.New(t)

Expand Down
15 changes: 15 additions & 0 deletions pkg/csi/cinder/openstack/openstack_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/gophercloud/gophercloud/openstack/blockstorage/v3/volumes"
"github.com/gophercloud/gophercloud/openstack/compute/v2/servers"
"github.com/stretchr/testify/mock"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/cloud-provider-openstack/pkg/util/metadata"
)

Expand Down Expand Up @@ -174,6 +175,20 @@ func (_m *OpenStackMock) WaitVolumeTargetStatus(volumeID string, tStatus []strin
return r0
}

// WaitVolumeTargetStatusWithCustomBackoff provides a mock function with given fields: volumeID, tStatus, backoff
func (_m *OpenStackMock) WaitVolumeTargetStatusWithCustomBackoff(volumeID string, tStatus []string, backoff *wait.Backoff) error {
ret := _m.Called(volumeID, tStatus, backoff)

var r0 error
if rf, ok := ret.Get(0).(func(string, []string, *wait.Backoff) error); ok {
r0 = rf(volumeID, tStatus, backoff)
} else {
r0 = ret.Error(0)
}

return r0
}

// WaitDiskDetached provides a mock function with given fields: instanceID, volumeID
func (_m *OpenStackMock) WaitDiskDetached(instanceID string, volumeID string) error {
ret := _m.Called(instanceID, volumeID)
Expand Down

0 comments on commit d34baf0

Please sign in to comment.