ceph: handle golangci-lint linter gosimple
this commit handles all the errors check for golangci-lint linter gosimple. Signed-off-by: subhamkrai <subhamkumarrai03@gmail.com>
This commit is contained in:
1 parent
513567f309
commit
25c116a4bd
42 files changed
+100
-159
No files matched your search
@@ -144,7 +144,7 @@ func (h *EdgefsInstaller) UninstallEdgefs(systemNamespace, namespace string) {
|
||||
h.k8shelper.Clientset.RbacV1().ClusterRoleBindings().Delete("rook-edgefs-system-psp", nil)
|
||||
|
||||
err = h.k8shelper.DeleteResourceAndWait(false, "podsecuritypolicy", "privileged")
|
||||
checkError(h.T(), err, fmt.Sprintf("cannot delete podsecuritypolicy `privileged`"))
|
||||
checkError(h.T(), err, "cannot delete podsecuritypolicy `privileged`")
|
||||
|
||||
err = h.k8shelper.DeleteResourceAndWait(false, "namespace", namespace)
|
||||
checkError(h.T(), err, fmt.Sprintf("cannot delete namespace %s", namespace))
|
||||
|
||||
@@ -147,16 +147,16 @@ func (h *NFSInstaller) UninstallNFSServer(systemNamespace, namespace string) {
|
||||
logger.Infof("uninstalling nfsserver from namespace %s", namespace)
|
||||
|
||||
err := h.k8shelper.DeleteResource("pvc", "nfs-pv-claim")
|
||||
checkError(h.T(), err, fmt.Sprintf("cannot remove nfs pvc : nfs-pv-claim"))
|
||||
checkError(h.T(), err, "cannot remove nfs pvc : nfs-pv-claim")
|
||||
|
||||
err = h.k8shelper.DeleteResource("pvc", "nfs-pv-claim-bigger")
|
||||
checkError(h.T(), err, fmt.Sprintf("cannot remove nfs pvc : nfs-pv-claim-bigger"))
|
||||
checkError(h.T(), err, "cannot remove nfs pvc : nfs-pv-claim-bigger")
|
||||
|
||||
err = h.k8shelper.DeleteResource("pv", "nfs-pv")
|
||||
checkError(h.T(), err, fmt.Sprintf("cannot remove nfs pv : nfs-pv"))
|
||||
checkError(h.T(), err, "cannot remove nfs pv : nfs-pv")
|
||||
|
||||
err = h.k8shelper.DeleteResource("pv", "nfs-pv1")
|
||||
checkError(h.T(), err, fmt.Sprintf("cannot remove nfs pv : nfs-pv1"))
|
||||
checkError(h.T(), err, "cannot remove nfs pv : nfs-pv1")
|
||||
|
||||
err = h.k8shelper.DeleteResource("-n", namespace, "nfsservers.nfs.rook.io", namespace)
|
||||
checkError(h.T(), err, fmt.Sprintf("cannot remove nfsserver %s", namespace))
|
||||
|
||||
@@ -81,7 +81,7 @@ func CreateK8sHelper(t func() *testing.T) (*K8sHelper, error) {
|
||||
}
|
||||
|
||||
h := &K8sHelper{executor: executor, Clientset: clientset, RookClientset: rookClientset, T: t}
|
||||
if strings.Index(config.Host, "//10.") != -1 {
|
||||
if strings.Contains(config.Host, "//10.") {
|
||||
h.RunningInCluster = true
|
||||
}
|
||||
return h, err
|
||||
@@ -148,7 +148,7 @@ func (k8sh *K8sHelper) KubectlWithStdin(stdin string, args ...string) (string, e
|
||||
|
||||
if cmdOut.ExitCode != 0 {
|
||||
k8slogger.Errorf("Failed to execute stdin: kubectl %v : %v", args, cmdOut.Err.Error())
|
||||
if strings.Index(cmdOut.Err.Error(), "(NotFound)") != -1 || strings.Index(cmdOut.StdErr, "(NotFound)") != -1 {
|
||||
if strings.Contains(cmdOut.Err.Error(), "(NotFound)") || strings.Contains(cmdOut.StdErr, "(NotFound)") {
|
||||
return cmdOut.StdErr, errors.NewNotFound(schema.GroupResource{}, "")
|
||||
}
|
||||
return cmdOut.StdErr, fmt.Errorf("Failed to run stdin: kubectl %v : %v", args, cmdOut.StdErr)
|
||||
@@ -556,7 +556,6 @@ func (k8sh *K8sHelper) GetEventsFromNamespace(namespace, testName, platformName
|
||||
return
|
||||
}
|
||||
file.WriteString(events)
|
||||
return
|
||||
}
|
||||
|
||||
func (k8sh *K8sHelper) appendPodDescribe(file *os.File, namespace, name string) {
|
||||
@@ -1464,10 +1463,7 @@ func (k8sh *K8sHelper) RestoreHostnames() ([]string, error) {
|
||||
func (k8sh *K8sHelper) IsRookInstalled(namespace string) bool {
|
||||
opts := metav1.GetOptions{}
|
||||
_, err := k8sh.Clientset.CoreV1().Services(namespace).Get("rook-ceph-mgr", opts)
|
||||
if err == nil {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
return err == nil
|
||||
}
|
||||
|
||||
// CollectPodLogsFromLabel collects logs for pods with the given label
|
||||
|
||||
@@ -120,10 +120,7 @@ func (h *MySQLHelper) TableRowCount() (count int) {
|
||||
// TableExists checks if a table exists
|
||||
func (h *MySQLHelper) TableExists() bool {
|
||||
_, err := h.DB.Query("SELECT 1 FROM LONGHAUL LIMIT 1 ")
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
return err == nil
|
||||
}
|
||||
|
||||
// DeleteRandomRow deletes a random row
|
||||
|
||||
Reference in new issue
Block a user