diff --git a/.golangci.yaml b/.golangci.yaml index 3b889db04..c121c51a6 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -31,9 +31,6 @@ linters: - linters: - staticcheck text: "QF1002:" # could use tagged switch on args[0] (staticcheck) - - linters: - - staticcheck - text: "ST1008:" # error should be returned as the last argument (staticcheck) - linters: - staticcheck text: "ST1019" # package "github.com/rook/rook/pkg/daemon/ceph/client" is being imported more than once (staticcheck) diff --git a/tests/framework/installer/ceph_installer.go b/tests/framework/installer/ceph_installer.go index bbff7b28c..c82a3b4ac 100644 --- a/tests/framework/installer/ceph_installer.go +++ b/tests/framework/installer/ceph_installer.go @@ -201,15 +201,15 @@ func (h *CephInstaller) CreateRookToolbox(manifests CephManifests) (err error) { } // Execute a command in the ceph toolbox -func (h *CephInstaller) Execute(command string, parameters []string, namespace string) (error, string) { +func (h *CephInstaller) Execute(command string, parameters []string, namespace string) (string, error) { clusterInfo := client.AdminTestClusterInfo(namespace) cmd, args := client.FinalizeCephCommandArgs(command, clusterInfo, parameters, h.k8shelper.MakeContext().ConfigDir) result, err := h.k8shelper.MakeContext().Executor.ExecuteCommandWithOutput(cmd, args...) if err != nil { logger.Warningf("Error executing command %q: <%v>", command, err) - return err, result + return result, err } - return nil, result + return result, nil } // CreateCephCluster creates rook cluster via kubectl diff --git a/tests/integration/ceph_base_object_test.go b/tests/integration/ceph_base_object_test.go index f997a480b..15e0025dd 100644 --- a/tests/integration/ceph_base_object_test.go +++ b/tests/integration/ceph_base_object_test.go @@ -178,7 +178,7 @@ func createCephObjectStore(t *testing.T, helper *clients.TestClient, k8sh *utils assert.Nil(t, err) for _, objectStore := range objectStores.Items { - err, output := installer.Execute("radosgw-admin", []string{"user", "info", "--uid=dashboard-admin", fmt.Sprintf("--rgw-realm=%s", objectStore.GetName())}, namespace) + output, err := installer.Execute("radosgw-admin", []string{"user", "info", "--uid=dashboard-admin", fmt.Sprintf("--rgw-realm=%s", objectStore.GetName())}, namespace) logger.Infof("output: %s", output) if err != nil { // Just log the error until we get a more reliable way to wait for the user to be created diff --git a/tests/integration/ceph_mgr_test.go b/tests/integration/ceph_mgr_test.go index 2687e8ae3..5f67ecc73 100644 --- a/tests/integration/ceph_mgr_test.go +++ b/tests/integration/ceph_mgr_test.go @@ -117,7 +117,7 @@ func (s *CephMgrSuite) executeWithRetry(command []string, maxRetries int) (strin tries := 0 orchestratorCommand := append([]string{"orch"}, command...) for { - err, output := s.installer.Execute("ceph", orchestratorCommand, s.namespace) + output, err := s.installer.Execute("ceph", orchestratorCommand, s.namespace) tries++ if err != nil { if maxRetries == 1 { @@ -150,7 +150,7 @@ volumeBindingMode: WaitForFirstConsumer ` err := s.k8sh.ResourceOperation("apply", localStorageClass) if err == nil { - err, _ = s.installer.Execute("ceph", []string{"config", "set", "mgr", "mgr/rook/storage_class", storageClassName}, s.namespace) + _, err = s.installer.Execute("ceph", []string{"config", "set", "mgr", "mgr/rook/storage_class", storageClassName}, s.namespace) if err == nil { logger.Infof("Storage class %q set in manager config", storageClassName) } else { @@ -163,7 +163,7 @@ volumeBindingMode: WaitForFirstConsumer func (s *CephMgrSuite) enableOrchestratorModule() { logger.Info("Enabling Rook orchestrator module: ") - err, output := s.installer.Execute("ceph", []string{"mgr", "module", "enable", "rook", "--force"}, s.namespace) + output, err := s.installer.Execute("ceph", []string{"mgr", "module", "enable", "rook", "--force"}, s.namespace) logger.Infof("output: %s", output) if err != nil { logger.Infof("Failed to enable rook orchestrator module: %q", err) diff --git a/tests/integration/object/bucketowner/bucketowner.go b/tests/integration/object/bucketowner/bucketowner.go index fc589762a..1932a9bf7 100644 --- a/tests/integration/object/bucketowner/bucketowner.go +++ b/tests/integration/object/bucketowner/bucketowner.go @@ -342,7 +342,7 @@ func TestObjectBucketClaimBucketOwner(t *testing.T, k8sh *utils.K8sHelper, insta // the rgw admin api is used to verify bucket ownership t.Run("setup rgw admin api client", func(t *testing.T) { - err, output := installer.Execute("radosgw-admin", []string{"user", "info", "--uid=dashboard-admin", fmt.Sprintf("--rgw-realm=%s", objectStore.Name)}, objectStore.Namespace) + output, err := installer.Execute("radosgw-admin", []string{"user", "info", "--uid=dashboard-admin", fmt.Sprintf("--rgw-realm=%s", objectStore.Name)}, objectStore.Namespace) require.NoError(t, err) // extract api creds from json output diff --git a/tests/integration/object/user/userkeys/userkeys.go b/tests/integration/object/user/userkeys/userkeys.go index da06e4f6e..e1cfbae5c 100644 --- a/tests/integration/object/user/userkeys/userkeys.go +++ b/tests/integration/object/user/userkeys/userkeys.go @@ -371,7 +371,7 @@ func TestObjectStoreUserKeys(t *testing.T, k8sh *utils.K8sHelper, installer *ins }) t.Run("setup rgw admin api client", func(t *testing.T) { - err, output := installer.Execute("radosgw-admin", []string{"user", "info", "--uid=dashboard-admin", fmt.Sprintf("--rgw-realm=%s", objectStore.Name)}, objectStore.Namespace) + output, err := installer.Execute("radosgw-admin", []string{"user", "info", "--uid=dashboard-admin", fmt.Sprintf("--rgw-realm=%s", objectStore.Name)}, objectStore.Namespace) require.NoError(t, err) // extract api creds from json output diff --git a/tests/integration/object/util/sns/sns.go b/tests/integration/object/util/sns/sns.go index 3ea9445bb..358934596 100644 --- a/tests/integration/object/util/sns/sns.go +++ b/tests/integration/object/util/sns/sns.go @@ -54,7 +54,7 @@ func (r *snsResolverV2) ResolveEndpoint(ctx context.Context, params sns.Endpoint } func GetS3Credentials(objectStore *cephv1.CephObjectStore, installer *installer.CephInstaller) (string, string, error) { - err, output := installer.Execute("radosgw-admin", []string{"user", "info", "--uid=dashboard-admin", fmt.Sprintf("--rgw-realm=%s", objectStore.Name)}, objectStore.Namespace) + output, err := installer.Execute("radosgw-admin", []string{"user", "info", "--uid=dashboard-admin", fmt.Sprintf("--rgw-realm=%s", objectStore.Name)}, objectStore.Namespace) if err != nil { return "", "", errors.Wrap(err, "failed to get user info") }