mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
ci: fix all linter errors found in golangci-lint
Fixing all the linter errors found in golang-ci lint v1.46.2 Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
committed by
mergify[bot]
parent
9e5cad173d
commit
1952a9b4b3
@ -514,8 +514,8 @@ var _ = Describe(cephfsType, func() {
|
||||
e2elog.Failf("failed to list pods for Deployment: %v", err)
|
||||
}
|
||||
|
||||
doStat := func(podName string) (stdErr string, err error) {
|
||||
_, stdErr, err = execCommandInContainerByPodName(
|
||||
doStat := func(podName string) (string, error) {
|
||||
_, stdErr, execErr := execCommandInContainerByPodName(
|
||||
f,
|
||||
fmt.Sprintf("stat %s", depl.Spec.Template.Spec.Containers[0].VolumeMounts[0].MountPath),
|
||||
depl.Namespace,
|
||||
@ -523,7 +523,7 @@ var _ = Describe(cephfsType, func() {
|
||||
depl.Spec.Template.Spec.Containers[0].Name,
|
||||
)
|
||||
|
||||
return stdErr, err
|
||||
return stdErr, execErr
|
||||
}
|
||||
ensureStatSucceeds := func(podName string) error {
|
||||
stdErr, statErr := doStat(podName)
|
||||
|
@ -60,7 +60,8 @@ func createCephfsStorageClass(
|
||||
c kubernetes.Interface,
|
||||
f *framework.Framework,
|
||||
enablePool bool,
|
||||
params map[string]string) error {
|
||||
params map[string]string,
|
||||
) error {
|
||||
scPath := fmt.Sprintf("%s/%s", cephFSExamplePath, "storageclass.yaml")
|
||||
sc, err := getStorageClass(scPath)
|
||||
if err != nil {
|
||||
@ -253,7 +254,8 @@ func getSnapName(snapNamespace, snapName string) (string, error) {
|
||||
func deleteBackingCephFSSubvolumeSnapshot(
|
||||
f *framework.Framework,
|
||||
pvc *v1.PersistentVolumeClaim,
|
||||
snap *snapapi.VolumeSnapshot) error {
|
||||
snap *snapapi.VolumeSnapshot,
|
||||
) error {
|
||||
snapshotName, err := getSnapName(snap.Namespace, snap.Name)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -30,7 +30,8 @@ func validateBiggerCloneFromPVC(f *framework.Framework,
|
||||
pvcPath,
|
||||
appPath,
|
||||
pvcClonePath,
|
||||
appClonePath string) error {
|
||||
appClonePath string,
|
||||
) error {
|
||||
const (
|
||||
size = "1Gi"
|
||||
newSize = "2Gi"
|
||||
|
@ -95,7 +95,8 @@ func createConfigMap(pluginPath string, c kubernetes.Interface, f *framework.Fra
|
||||
func createCustomConfigMap(
|
||||
c kubernetes.Interface,
|
||||
pluginPath string,
|
||||
clusterInfo map[string]map[string]string) error {
|
||||
clusterInfo map[string]map[string]string,
|
||||
) error {
|
||||
path := pluginPath + configMap
|
||||
cm := v1.ConfigMap{}
|
||||
err := unmarshal(path, &cm)
|
||||
|
@ -40,7 +40,8 @@ func execCommandInPodWithName(
|
||||
cmdString,
|
||||
podName,
|
||||
containerName,
|
||||
nameSpace string) (string, string, error) {
|
||||
nameSpace string,
|
||||
) (string, string, error) {
|
||||
cmd := []string{"/bin/sh", "-c", cmdString}
|
||||
podOpt := framework.ExecOptions{
|
||||
Command: cmd,
|
||||
|
@ -143,7 +143,8 @@ func createNFSStorageClass(
|
||||
c clientset.Interface,
|
||||
f *framework.Framework,
|
||||
enablePool bool,
|
||||
params map[string]string) error {
|
||||
params map[string]string,
|
||||
) error {
|
||||
scPath := fmt.Sprintf("%s/%s", nfsExamplePath, "storageclass.yaml")
|
||||
sc, err := getStorageClass(scPath)
|
||||
if err != nil {
|
||||
|
12
e2e/pod.go
12
e2e/pod.go
@ -136,7 +136,8 @@ func findPodAndContainerName(f *framework.Framework, ns, cn string, opt *metav1.
|
||||
func getCommandInPodOpts(
|
||||
f *framework.Framework,
|
||||
c, ns, cn string,
|
||||
opt *metav1.ListOptions) (framework.ExecOptions, error) {
|
||||
opt *metav1.ListOptions,
|
||||
) (framework.ExecOptions, error) {
|
||||
cmd := []string{"/bin/sh", "-c", c}
|
||||
pName, cName, err := findPodAndContainerName(f, ns, cn, opt)
|
||||
if err != nil {
|
||||
@ -161,7 +162,8 @@ func getCommandInPodOpts(
|
||||
// stderr is returned as a string, and err will be set on a failure.
|
||||
func execCommandInDaemonsetPod(
|
||||
f *framework.Framework,
|
||||
c, daemonsetName, nodeName, containerName, ns string) (string, error) {
|
||||
c, daemonsetName, nodeName, containerName, ns string,
|
||||
) (string, error) {
|
||||
selector, err := getDaemonSetLabelSelector(f, ns, daemonsetName)
|
||||
if err != nil {
|
||||
return "", err
|
||||
@ -224,7 +226,8 @@ func execCommandInPod(f *framework.Framework, c, ns string, opt *metav1.ListOpti
|
||||
}
|
||||
|
||||
func execCommandInContainer(
|
||||
f *framework.Framework, c, ns, cn string, opt *metav1.ListOptions) (string, string, error) {
|
||||
f *framework.Framework, c, ns, cn string, opt *metav1.ListOptions,
|
||||
) (string, string, error) {
|
||||
podOpt, err := getCommandInPodOpts(f, c, ns, cn, opt)
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
@ -468,7 +471,8 @@ func validateRWOPPodCreation(
|
||||
f *framework.Framework,
|
||||
pvc *v1.PersistentVolumeClaim,
|
||||
app *v1.Pod,
|
||||
baseAppName string) error {
|
||||
baseAppName string,
|
||||
) error {
|
||||
var err error
|
||||
// create one more app with same PVC
|
||||
name := fmt.Sprintf("%s%d", f.UniqueName, deployTimeout)
|
||||
|
@ -239,7 +239,8 @@ func getPersistentVolume(c kubernetes.Interface, name string) (*v1.PersistentVol
|
||||
|
||||
func getPVCAndPV(
|
||||
c kubernetes.Interface,
|
||||
pvcName, pvcNamespace string) (*v1.PersistentVolumeClaim, *v1.PersistentVolume, error) {
|
||||
pvcName, pvcNamespace string,
|
||||
) (*v1.PersistentVolumeClaim, *v1.PersistentVolume, error) {
|
||||
pvc, err := getPersistentVolumeClaim(c, pvcNamespace, pvcName)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("failed to get PVC: %w", err)
|
||||
|
@ -117,7 +117,8 @@ func createRBDStorageClass(
|
||||
f *framework.Framework,
|
||||
name string,
|
||||
scOptions, parameters map[string]string,
|
||||
policy v1.PersistentVolumeReclaimPolicy) error {
|
||||
policy v1.PersistentVolumeReclaimPolicy,
|
||||
) error {
|
||||
scPath := fmt.Sprintf("%s/%s", rbdExamplePath, "storageclass.yaml")
|
||||
sc, err := getStorageClass(scPath)
|
||||
if err != nil {
|
||||
@ -281,7 +282,7 @@ func getImageMeta(rbdImageSpec, metaKey string, f *framework.Framework) (string,
|
||||
return "", err
|
||||
}
|
||||
if stdErr != "" {
|
||||
return strings.TrimSpace(stdOut), fmt.Errorf(stdErr)
|
||||
return strings.TrimSpace(stdOut), fmt.Errorf("%s", stdErr)
|
||||
}
|
||||
|
||||
return strings.TrimSpace(stdOut), nil
|
||||
@ -757,7 +758,8 @@ func checkPVCImageInPool(f *framework.Framework, pvc *v1.PersistentVolumeClaim,
|
||||
func checkPVCDataPoolForImageInPool(
|
||||
f *framework.Framework,
|
||||
pvc *v1.PersistentVolumeClaim,
|
||||
pool, dataPool string) error {
|
||||
pool, dataPool string,
|
||||
) error {
|
||||
stdOut, err := getPVCImageInfoInPool(f, pvc, pool)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -300,7 +300,8 @@ func validateBiggerPVCFromSnapshot(f *framework.Framework,
|
||||
appPath,
|
||||
snapPath,
|
||||
pvcClonePath,
|
||||
appClonePath string) error {
|
||||
appClonePath string,
|
||||
) error {
|
||||
const (
|
||||
size = "1Gi"
|
||||
newSize = "2Gi"
|
||||
|
@ -41,7 +41,8 @@ const (
|
||||
func getStaticPV(
|
||||
name, volName, size, secretName, secretNS, sc, driverName string,
|
||||
blockPV bool,
|
||||
options, annotations map[string]string, policy v1.PersistentVolumeReclaimPolicy) *v1.PersistentVolume {
|
||||
options, annotations map[string]string, policy v1.PersistentVolumeReclaimPolicy,
|
||||
) *v1.PersistentVolume {
|
||||
pv := &v1.PersistentVolume{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: name,
|
||||
@ -491,7 +492,8 @@ func validateRBDStaticResize(
|
||||
app *v1.Pod,
|
||||
appOpt *metav1.ListOptions,
|
||||
pvc *v1.PersistentVolumeClaim,
|
||||
rbdImageName string) error {
|
||||
rbdImageName string,
|
||||
) error {
|
||||
// resize rbd image
|
||||
size := staticPVNewSize
|
||||
cmd := fmt.Sprintf(
|
||||
|
23
e2e/utils.go
23
e2e/utils.go
@ -341,7 +341,8 @@ func createPVCAndApp(
|
||||
f *framework.Framework,
|
||||
pvc *v1.PersistentVolumeClaim,
|
||||
app *v1.Pod,
|
||||
pvcTimeout int) error {
|
||||
pvcTimeout int,
|
||||
) error {
|
||||
if name != "" {
|
||||
pvc.Name = name
|
||||
app.Name = name
|
||||
@ -361,7 +362,8 @@ func createPVCAndDeploymentApp(
|
||||
f *framework.Framework,
|
||||
pvc *v1.PersistentVolumeClaim,
|
||||
app *appsv1.Deployment,
|
||||
pvcTimeout int) error {
|
||||
pvcTimeout int,
|
||||
) error {
|
||||
err := createPVCAndvalidatePV(f.ClientSet, pvc, pvcTimeout)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -414,7 +416,8 @@ func validatePVCAndDeploymentAppBinding(
|
||||
func deletePVCAndDeploymentApp(
|
||||
f *framework.Framework,
|
||||
pvc *v1.PersistentVolumeClaim,
|
||||
app *appsv1.Deployment) error {
|
||||
app *appsv1.Deployment,
|
||||
) error {
|
||||
err := deleteDeploymentApp(f.ClientSet, app.Name, app.Namespace, deployTimeout)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -445,7 +448,8 @@ func deletePVCAndApp(name string, f *framework.Framework, pvc *v1.PersistentVolu
|
||||
func createPVCAndAppBinding(
|
||||
pvcPath, appPath string,
|
||||
f *framework.Framework,
|
||||
pvcTimeout int) (*v1.PersistentVolumeClaim, *v1.Pod, error) {
|
||||
pvcTimeout int,
|
||||
) (*v1.PersistentVolumeClaim, *v1.Pod, error) {
|
||||
pvc, err := loadPVC(pvcPath)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
@ -486,7 +490,7 @@ func getMountType(selector, mountPath string, f *framework.Framework) (string, e
|
||||
return "", err
|
||||
}
|
||||
if stdErr != "" {
|
||||
return strings.TrimSpace(stdOut), fmt.Errorf(stdErr)
|
||||
return strings.TrimSpace(stdOut), fmt.Errorf("%s", stdErr)
|
||||
}
|
||||
|
||||
return strings.TrimSpace(stdOut), nil
|
||||
@ -802,7 +806,8 @@ func validatePVCClone(
|
||||
dataPool string,
|
||||
kms kmsConfig,
|
||||
validatePVC validateFunc,
|
||||
f *framework.Framework) {
|
||||
f *framework.Framework,
|
||||
) {
|
||||
var wg sync.WaitGroup
|
||||
wgErrs := make([]error, totalCount)
|
||||
chErrs := make([]error, totalCount)
|
||||
@ -1013,7 +1018,8 @@ func validatePVCSnapshot(
|
||||
totalCount int,
|
||||
pvcPath, appPath, snapshotPath, pvcClonePath, appClonePath string,
|
||||
kms, restoreKMS kmsConfig, restoreSCName,
|
||||
dataPool string, f *framework.Framework) {
|
||||
dataPool string, f *framework.Framework,
|
||||
) {
|
||||
var wg sync.WaitGroup
|
||||
wgErrs := make([]error, totalCount)
|
||||
chErrs := make([]error, totalCount)
|
||||
@ -1358,7 +1364,8 @@ func validatePVCSnapshot(
|
||||
func validateController(
|
||||
f *framework.Framework,
|
||||
pvcPath, appPath, scPath string,
|
||||
scOptions, scParams map[string]string) error {
|
||||
scOptions, scParams map[string]string,
|
||||
) error {
|
||||
size := "1Gi"
|
||||
poolName := defaultRBDPool
|
||||
expandSize := "10Gi"
|
||||
|
Reference in New Issue
Block a user