mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-04-11 18:13:00 +00:00
cleanup: address govet warnings
We had "ns" as a parameter and then trying to declare it also as a local variable, which is what the complaint about "shadowing" refers to. Issue reported: shadow: declaration of "ns" shadows declaration at line 57 (govet) Signed-off-by: Yug <yuggupta27@gmail.com>
This commit is contained in:
parent
94b745d573
commit
2bfe7670d2
@ -83,7 +83,7 @@ func validateRBDStaticPV(f *framework.Framework, appPath string, isBlock bool) e
|
|||||||
rbdImageName = "test-static-pv"
|
rbdImageName = "test-static-pv"
|
||||||
pvName = "pv-name"
|
pvName = "pv-name"
|
||||||
pvcName = "pvc-name"
|
pvcName = "pvc-name"
|
||||||
ns = f.UniqueName
|
namespace = f.UniqueName
|
||||||
// minikube creates default class in cluster, we need to set dummy
|
// minikube creates default class in cluster, we need to set dummy
|
||||||
// storageclass on PV and PVC to avoid storageclass name missmatch
|
// storageclass on PV and PVC to avoid storageclass name missmatch
|
||||||
sc = "storage-class"
|
sc = "storage-class"
|
||||||
@ -117,7 +117,7 @@ func validateRBDStaticPV(f *framework.Framework, appPath string, isBlock bool) e
|
|||||||
return fmt.Errorf("PV Create API error: %v", err)
|
return fmt.Errorf("PV Create API error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
pvc := getStaticPVC(pvcName, pvName, size, ns, sc, isBlock)
|
pvc := getStaticPVC(pvcName, pvName, size, namespace, sc, isBlock)
|
||||||
|
|
||||||
_, err = c.CoreV1().PersistentVolumeClaims(pvc.Namespace).Create(context.TODO(), pvc, metav1.CreateOptions{})
|
_, err = c.CoreV1().PersistentVolumeClaims(pvc.Namespace).Create(context.TODO(), pvc, metav1.CreateOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -129,7 +129,7 @@ func validateRBDStaticPV(f *framework.Framework, appPath string, isBlock bool) e
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
app.Namespace = ns
|
app.Namespace = namespace
|
||||||
app.Spec.Volumes[0].PersistentVolumeClaim.ClaimName = pvcName
|
app.Spec.Volumes[0].PersistentVolumeClaim.ClaimName = pvcName
|
||||||
err = createApp(f.ClientSet, app, deployTimeout)
|
err = createApp(f.ClientSet, app, deployTimeout)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -164,7 +164,7 @@ func validateCephFsStaticPV(f *framework.Framework, appPath, scPath string) erro
|
|||||||
fsName = "myfs"
|
fsName = "myfs"
|
||||||
pvName = "pv-name"
|
pvName = "pv-name"
|
||||||
pvcName = "pvc-name"
|
pvcName = "pvc-name"
|
||||||
ns = f.UniqueName
|
namespace = f.UniqueName
|
||||||
// minikube creates default storage class in cluster, we need to set dummy
|
// minikube creates default storage class in cluster, we need to set dummy
|
||||||
// storageclass on PV and PVC to avoid storageclass name missmatch
|
// storageclass on PV and PVC to avoid storageclass name missmatch
|
||||||
sc = "storage-class"
|
sc = "storage-class"
|
||||||
@ -237,7 +237,7 @@ func validateCephFsStaticPV(f *framework.Framework, appPath, scPath string) erro
|
|||||||
return fmt.Errorf("failed to create PV, error %v", err)
|
return fmt.Errorf("failed to create PV, error %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
pvc := getStaticPVC(pvcName, pvName, size, ns, sc, false)
|
pvc := getStaticPVC(pvcName, pvName, size, namespace, sc, false)
|
||||||
_, err = c.CoreV1().PersistentVolumeClaims(pvc.Namespace).Create(context.TODO(), pvc, metav1.CreateOptions{})
|
_, err = c.CoreV1().PersistentVolumeClaims(pvc.Namespace).Create(context.TODO(), pvc, metav1.CreateOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to create PVC, error %v", err)
|
return fmt.Errorf("failed to create PVC, error %v", err)
|
||||||
@ -248,14 +248,14 @@ func validateCephFsStaticPV(f *framework.Framework, appPath, scPath string) erro
|
|||||||
return fmt.Errorf("failed to load app, error %v", err)
|
return fmt.Errorf("failed to load app, error %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
app.Namespace = ns
|
app.Namespace = namespace
|
||||||
app.Spec.Volumes[0].PersistentVolumeClaim.ClaimName = pvcName
|
app.Spec.Volumes[0].PersistentVolumeClaim.ClaimName = pvcName
|
||||||
err = createApp(f.ClientSet, app, deployTimeout)
|
err = createApp(f.ClientSet, app, deployTimeout)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to create pod, error %v", err)
|
return fmt.Errorf("failed to create pod, error %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = deletePod(app.Name, ns, f.ClientSet, deployTimeout)
|
err = deletePod(app.Name, namespace, f.ClientSet, deployTimeout)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to delete pod, error %v", err)
|
return fmt.Errorf("failed to delete pod, error %v", err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user