cleanup the volume plugin for recycle

update commit to reflect changes
This commit is contained in:
Kevin Griffith
2017-01-23 13:49:00 -06:00
parent 6f37347fce
commit 9448aa66ff
12 changed files with 56 additions and 208 deletions

View File

@@ -1222,17 +1222,11 @@ func (plugin *mockVolumePlugin) GetMetrics() (*vol.Metrics, error) {
// Recycler interfaces
func (plugin *mockVolumePlugin) NewRecycler(pvName string, spec *vol.Spec, eventRecorder vol.RecycleEventRecorder) (vol.Recycler, error) {
if len(plugin.recycleCalls) > 0 {
// mockVolumePlugin directly implements Recycler interface
glog.V(4).Infof("mock plugin NewRecycler called, returning mock recycler")
return plugin, nil
} else {
return nil, fmt.Errorf("Mock plugin error: no recycleCalls configured")
func (plugin *mockVolumePlugin) Recycle(pvName string, spec *vol.Spec, eventRecorder vol.RecycleEventRecorder) error {
if len(plugin.recycleCalls) == 0 {
return fmt.Errorf("Mock plugin error: no recycleCalls configured")
}
}
func (plugin *mockVolumePlugin) Recycle() error {
if len(plugin.recycleCalls) <= plugin.recycleCallCounter {
return fmt.Errorf("Mock plugin error: unexpected recycle call %d", plugin.recycleCallCounter)
}