fgksgf commented on a change in pull request #3:
URL: https://github.com/apache/skywalking-infra-e2e/pull/3#discussion_r563499884



##########
File path: commands/setup/setup.go
##########
@@ -49,9 +56,42 @@ var Setup = &cobra.Command{
                        if err := setup.KindSetupInCommand(); err != nil {
                                return err
                        }
+               } else if flags.Env == "" {
+                       // setup according e2e.yaml
+                       err := setupAccordingE2E()
+                       if err != nil {
+                               return err
+                       }
                } else {
                        return fmt.Errorf("no such env for setup: [%s]. should 
use kind or compose instead", flags.Env)
                }
                return nil
        },
 }
+
+func setupAccordingE2E() error {
+       // setup according e2e.yaml
+       e2eFile := constant.E2EDefaultFile
+       logger.Log.Infof("reading e2e config file:%s", e2eFile)
+       data, err := ioutil.ReadFile(e2eFile)
+       if err != nil {
+               return err
+       }
+
+       e2eConfig := config.E2EConfig{}
+       err = yaml.Unmarshal(data, &e2eConfig)
+       if err != nil {
+               return err
+       }
+

Review comment:
       I have a question. Do we need read the config every time we run a 
command (`setup`, `trigger`, etc.)? Will it be better that read the config only 
once, then the config could be shared among commands.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to