From 071d787a45c5cc0692f9018b17fe475f5ce30e29 Mon Sep 17 00:00:00 2001 From: William Banfield Date: Tue, 18 Oct 2022 15:05:58 -0400 Subject: [PATCH] add infrastructure type and data flags --- test/e2e/runner/main.go | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/test/e2e/runner/main.go b/test/e2e/runner/main.go index 825aac989..21fa6ccae 100644 --- a/test/e2e/runner/main.go +++ b/test/e2e/runner/main.go @@ -45,10 +45,25 @@ func NewCLI() *CLI { if err != nil { return err } - ifd, err := e2e.NewDockerInfrastructure(m) + + t, err := cmd.Flags().GetString("infrastructure-type") if err != nil { return err } + + var ifd e2e.InfrastructureData + switch t { + case "docker": + var err error + ifd, err = e2e.NewDockerInfrastructure(m) + if err != nil { + return err + } + // TODO(williambanfield): add a section that implements the 'digital-ocean' infrastructure-type + default: + return fmt.Errorf("unknown infrastructure type '%s'", t) + } + testnet, err := e2e.LoadTestnet(file, ifd) if err != nil { return err @@ -126,6 +141,10 @@ func NewCLI() *CLI { cli.root.PersistentFlags().StringP("file", "f", "", "Testnet TOML manifest") _ = cli.root.MarkPersistentFlagRequired("file") + cli.root.PersistentFlags().StringP("infrastructure-type", "", "docker", "Backing infrastructure used to run the testnet. Either 'digital-ocean' or 'docker'") + + cli.root.PersistentFlags().StringP("infrastructure-data", "", "", "path to the json file containing the infrastructure data. Only used if the 'infrastructure-type' is set to a value other than 'docker'") + cli.root.Flags().BoolVarP(&cli.preserve, "preserve", "p", false, "Preserves the running of the test net after tests are completed")