mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 09:49:50 +00:00
parent
bb48546658
commit
c18ecb0825
@ -387,6 +387,10 @@ func (pm *VolumePluginMgr) FindPluginBySpec(spec *Spec) (VolumePlugin, error) {
|
|||||||
pm.mutex.Lock()
|
pm.mutex.Lock()
|
||||||
defer pm.mutex.Unlock()
|
defer pm.mutex.Unlock()
|
||||||
|
|
||||||
|
if spec == nil {
|
||||||
|
return nil, fmt.Errorf("Could not find plugin because volume spec is nil")
|
||||||
|
}
|
||||||
|
|
||||||
matches := []string{}
|
matches := []string{}
|
||||||
for k, v := range pm.plugins {
|
for k, v := range pm.plugins {
|
||||||
if v.CanSupport(spec) {
|
if v.CanSupport(spec) {
|
||||||
|
@ -112,6 +112,17 @@ func TestVolumePluginMgrFunc(t *testing.T) {
|
|||||||
if plug.GetPluginName() != "testPlugin" {
|
if plug.GetPluginName() != "testPlugin" {
|
||||||
t.Errorf("Wrong name: %s", plug.GetPluginName())
|
t.Errorf("Wrong name: %s", plug.GetPluginName())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
plug, err = vpm.FindPluginBySpec(nil)
|
||||||
|
if err == nil {
|
||||||
|
t.Errorf("Should return error if volume spec is nil")
|
||||||
|
}
|
||||||
|
|
||||||
|
volumeSpec := &Spec{}
|
||||||
|
plug, err = vpm.FindPluginBySpec(volumeSpec)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("Should return test plugin if volume spec is not nil")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_ValidatePodTemplate(t *testing.T) {
|
func Test_ValidatePodTemplate(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user