You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ho...@apache.org on 2021/02/06 12:56:57 UTC

[skywalking-infra-e2e] 02/04: move precheck to setup

This is an automated email from the ASF dual-hosted git repository.

hoshea pushed a commit to branch verifier
in repository https://gitbox.apache.org/repos/asf/skywalking-infra-e2e.git

commit 09734846fa148887114b0d1af64db5b83f3332cd
Author: Hoshea <fg...@gmail.com>
AuthorDate: Fri Feb 5 22:30:31 2021 +0800

    move precheck to setup
---
 commands/root.go        | 17 -----------------
 commands/setup/setup.go | 19 +++++++++++++++----
 2 files changed, 15 insertions(+), 21 deletions(-)

diff --git a/commands/root.go b/commands/root.go
index 3843d61..eff9b6c 100644
--- a/commands/root.go
+++ b/commands/root.go
@@ -20,11 +20,6 @@ package commands
 import (
 	"github.com/spf13/cobra"
 
-	"github.com/apache/skywalking-infra-e2e/internal/util"
-
-	"github.com/apache/skywalking-infra-e2e/internal/config"
-	"github.com/apache/skywalking-infra-e2e/internal/constant"
-
 	"github.com/apache/skywalking-infra-e2e/commands/cleanup"
 	"github.com/apache/skywalking-infra-e2e/commands/run"
 	"github.com/apache/skywalking-infra-e2e/commands/setup"
@@ -39,18 +34,6 @@ var Root = &cobra.Command{
 	Version:       version,
 	SilenceErrors: true,
 	SilenceUsage:  true,
-	PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
-		err := util.CheckDockerDaemon()
-		if err != nil {
-			return err
-		}
-
-		err = config.ReadGlobalConfigFile(constant.E2EDefaultFile)
-		if err != nil {
-			return err
-		}
-		return nil
-	},
 }
 
 // Execute adds all child commands to the root command and sets flags appropriately.
diff --git a/commands/setup/setup.go b/commands/setup/setup.go
index b1f9f7c..92874d4 100644
--- a/commands/setup/setup.go
+++ b/commands/setup/setup.go
@@ -21,19 +21,30 @@ package setup
 import (
 	"fmt"
 
+	"github.com/apache/skywalking-infra-e2e/internal/components/setup"
 	"github.com/apache/skywalking-infra-e2e/internal/config"
-
 	"github.com/apache/skywalking-infra-e2e/internal/constant"
+	"github.com/apache/skywalking-infra-e2e/internal/logger"
+	"github.com/apache/skywalking-infra-e2e/internal/util"
 
 	"github.com/spf13/cobra"
-
-	"github.com/apache/skywalking-infra-e2e/internal/components/setup"
-	"github.com/apache/skywalking-infra-e2e/internal/logger"
 )
 
 var Setup = &cobra.Command{
 	Use:   "setup",
 	Short: "",
+	PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
+		err := util.CheckDockerDaemon()
+		if err != nil {
+			return err
+		}
+
+		err = config.ReadGlobalConfigFile(constant.E2EDefaultFile)
+		if err != nil {
+			return err
+		}
+		return nil
+	},
 	RunE: func(cmd *cobra.Command, args []string) error {
 		err := setupAccordingE2E()
 		if err != nil {