diff --git a/pkg/volume/hostpath/host_path.go b/pkg/volume/hostpath/host_path.go index 3fa56d5c8c2..3646a9d205f 100644 --- a/pkg/volume/hostpath/host_path.go +++ b/pkg/volume/hostpath/host_path.go @@ -160,7 +160,7 @@ func (plugin *hostPathPlugin) NewDeleter(spec *volume.Spec) (volume.Deleter, err func (plugin *hostPathPlugin) NewProvisioner(options volume.VolumeOptions) (volume.Provisioner, error) { if !plugin.config.ProvisioningEnabled { - return nil, fmt.Errorf("Provisioning in volume plugin %q is disabled", plugin.GetPluginName()) + return nil, fmt.Errorf("provisioning in volume plugin %q is disabled", plugin.GetPluginName()) } return newProvisioner(options, plugin.host, plugin) } @@ -341,7 +341,7 @@ func getVolumeSource(spec *volume.Spec) (*v1.HostPathVolumeSource, bool, error) return spec.PersistentVolume.Spec.HostPath, spec.ReadOnly, nil } - return nil, false, fmt.Errorf("Spec does not reference an HostPath volume type") + return nil, false, fmt.Errorf("spec does not reference an HostPath volume type") } type hostPathTypeChecker interface { diff --git a/pkg/volume/hostpath/host_path_test.go b/pkg/volume/hostpath/host_path_test.go index f1b96efd53d..8c9c9c4b668 100644 --- a/pkg/volume/hostpath/host_path_test.go +++ b/pkg/volume/hostpath/host_path_test.go @@ -52,11 +52,11 @@ func TestCanSupport(t *testing.T) { plugMgr := volume.VolumePluginMgr{} plugMgr.InitPlugins(ProbeVolumePlugins(volume.VolumeConfig{}), nil /* prober */, volumetest.NewFakeVolumeHost(t, "fake", nil, nil)) - plug, err := plugMgr.FindPluginByName("kubernetes.io/host-path") + plug, err := plugMgr.FindPluginByName(hostPathPluginName) if err != nil { - t.Errorf("Can't find the plugin by name") + t.Fatal("Can't find the plugin by name") } - if plug.GetPluginName() != "kubernetes.io/host-path" { + if plug.GetPluginName() != hostPathPluginName { t.Errorf("Wrong name: %s", plug.GetPluginName()) } if !plug.CanSupport(&volume.Spec{Volume: &v1.Volume{VolumeSource: v1.VolumeSource{HostPath: &v1.HostPathVolumeSource{}}}}) { @@ -74,9 +74,9 @@ func TestGetAccessModes(t *testing.T) { plugMgr := volume.VolumePluginMgr{} plugMgr.InitPlugins(ProbeVolumePlugins(volume.VolumeConfig{}), nil /* prober */, volumetest.NewFakeVolumeHost(t, "/tmp/fake", nil, nil)) - plug, err := plugMgr.FindPersistentPluginByName("kubernetes.io/host-path") + plug, err := plugMgr.FindPersistentPluginByName(hostPathPluginName) if err != nil { - t.Errorf("Can't find the plugin by name") + t.Fatal("Can't find the plugin by name") } if len(plug.GetAccessModes()) != 1 || plug.GetAccessModes()[0] != v1.ReadWriteOnce { t.Errorf("Expected %s PersistentVolumeAccessMode", v1.ReadWriteOnce) @@ -109,7 +109,7 @@ func TestDeleter(t *testing.T) { spec := &volume.Spec{PersistentVolume: &v1.PersistentVolume{Spec: v1.PersistentVolumeSpec{PersistentVolumeSource: v1.PersistentVolumeSource{HostPath: &v1.HostPathVolumeSource{Path: tempPath}}}}} plug, err := plugMgr.FindDeletablePluginBySpec(spec) if err != nil { - t.Errorf("Can't find the plugin by name") + t.Fatal("Can't find the plugin by name") } deleter, err := plug.NewDeleter(spec) if err != nil { @@ -230,9 +230,9 @@ func TestPlugin(t *testing.T) { plugMgr := volume.VolumePluginMgr{} plugMgr.InitPlugins(ProbeVolumePlugins(volume.VolumeConfig{}), nil /* prober */, volumetest.NewFakeVolumeHost(t, "fake", nil, nil)) - plug, err := plugMgr.FindPluginByName("kubernetes.io/host-path") + plug, err := plugMgr.FindPluginByName(hostPathPluginName) if err != nil { - t.Errorf("Can't find the plugin by name") + t.Fatal("Can't find the plugin by name") } volPath := "/tmp/vol1"