mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 05:27:21 +00:00
add or fix some errors return statements and ineffassign
Signed-off-by: haoshuwei <haoshuwei24@gmail.com>
This commit is contained in:
parent
52626339b1
commit
b752997036
@ -67,7 +67,6 @@ pkg/volume
|
|||||||
pkg/volume/awsebs
|
pkg/volume/awsebs
|
||||||
pkg/volume/azure_dd
|
pkg/volume/azure_dd
|
||||||
pkg/volume/azure_file
|
pkg/volume/azure_file
|
||||||
pkg/volume/cephfs
|
|
||||||
pkg/volume/cinder
|
pkg/volume/cinder
|
||||||
pkg/volume/csi
|
pkg/volume/csi
|
||||||
pkg/volume/emptydir
|
pkg/volume/emptydir
|
||||||
|
@ -267,11 +267,17 @@ func TestMounterAndUnmounterTypeAssert(t *testing.T) {
|
|||||||
fake := &mount.FakeMounter{}
|
fake := &mount.FakeMounter{}
|
||||||
pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{UID: types.UID("poduid")}}
|
pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{UID: types.UID("poduid")}}
|
||||||
mounter, err := plug.(*azureFilePlugin).newMounterInternal(volume.NewSpecFromVolume(spec), pod, &fakeAzureSvc{}, fake)
|
mounter, err := plug.(*azureFilePlugin).newMounterInternal(volume.NewSpecFromVolume(spec), pod, &fakeAzureSvc{}, fake)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("MounterInternal() failed: %v", err)
|
||||||
|
}
|
||||||
if _, ok := mounter.(volume.Unmounter); ok {
|
if _, ok := mounter.(volume.Unmounter); ok {
|
||||||
t.Errorf("Volume Mounter can be type-assert to Unmounter")
|
t.Errorf("Volume Mounter can be type-assert to Unmounter")
|
||||||
}
|
}
|
||||||
|
|
||||||
unmounter, err := plug.(*azureFilePlugin).newUnmounterInternal("vol1", types.UID("poduid"), &mount.FakeMounter{})
|
unmounter, err := plug.(*azureFilePlugin).newUnmounterInternal("vol1", types.UID("poduid"), &mount.FakeMounter{})
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("MounterInternal() failed: %v", err)
|
||||||
|
}
|
||||||
if _, ok := unmounter.(volume.Mounter); ok {
|
if _, ok := unmounter.(volume.Mounter); ok {
|
||||||
t.Errorf("Volume Unmounter can be type-assert to Mounter")
|
t.Errorf("Volume Unmounter can be type-assert to Mounter")
|
||||||
}
|
}
|
||||||
|
@ -128,6 +128,9 @@ func TestConstructVolumeSpec(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cephfsSpec, err := plug.(*cephfsPlugin).ConstructVolumeSpec("cephfsVolume", "/cephfsVolume/")
|
cephfsSpec, err := plug.(*cephfsPlugin).ConstructVolumeSpec("cephfsVolume", "/cephfsVolume/")
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("ConstructVolumeSpec() failed: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
if cephfsSpec.Name() != "cephfsVolume" {
|
if cephfsSpec.Name() != "cephfsVolume" {
|
||||||
t.Errorf("Get wrong cephfs spec name, got: %s", cephfsSpec.Name())
|
t.Errorf("Get wrong cephfs spec name, got: %s", cephfsSpec.Name())
|
||||||
|
@ -524,7 +524,7 @@ func (c *cinderVolumeUnmounter) TearDownAt(dir string) error {
|
|||||||
defer c.plugin.volumeLocks.UnlockKey(c.pdName)
|
defer c.plugin.volumeLocks.UnlockKey(c.pdName)
|
||||||
|
|
||||||
// Reload list of references, there might be SetUpAt finished in the meantime
|
// Reload list of references, there might be SetUpAt finished in the meantime
|
||||||
refs, err = c.mounter.GetMountRefs(dir)
|
_, err = c.mounter.GetMountRefs(dir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.V(4).Infof("GetMountRefs failed: %v", err)
|
klog.V(4).Infof("GetMountRefs failed: %v", err)
|
||||||
return err
|
return err
|
||||||
|
@ -202,6 +202,9 @@ func TestPlugin(t *testing.T) {
|
|||||||
PersistentVolumeReclaimPolicy: v1.PersistentVolumeReclaimDelete,
|
PersistentVolumeReclaimPolicy: v1.PersistentVolumeReclaimDelete,
|
||||||
}
|
}
|
||||||
provisioner, err := plug.(*cinderPlugin).newProvisionerInternal(options, &fakePDManager{0})
|
provisioner, err := plug.(*cinderPlugin).newProvisionerInternal(options, &fakePDManager{0})
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("ProvisionerInternal() failed: %v", err)
|
||||||
|
}
|
||||||
persistentSpec, err := provisioner.Provision(nil, nil)
|
persistentSpec, err := provisioner.Provision(nil, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Provision() failed: %v", err)
|
t.Errorf("Provision() failed: %v", err)
|
||||||
@ -254,6 +257,9 @@ func TestPlugin(t *testing.T) {
|
|||||||
PersistentVolume: persistentSpec,
|
PersistentVolume: persistentSpec,
|
||||||
}
|
}
|
||||||
deleter, err := plug.(*cinderPlugin).newDeleterInternal(volSpec, &fakePDManager{0})
|
deleter, err := plug.(*cinderPlugin).newDeleterInternal(volSpec, &fakePDManager{0})
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("DeleterInternal() failed: %v", err)
|
||||||
|
}
|
||||||
err = deleter.Delete()
|
err = deleter.Delete()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Deleter() failed: %v", err)
|
t.Errorf("Deleter() failed: %v", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user