diff --git a/testing/internal/e2e/host/static/env.go b/testing/internal/e2e/host/static/env.go new file mode 100644 index 000000000..944f97f22 --- /dev/null +++ b/testing/internal/e2e/host/static/env.go @@ -0,0 +1,20 @@ +package static_test + +import "github.com/kelseyhightower/envconfig" + +type config struct { + TargetIp string `envconfig:"E2E_TARGET_IP" required:"true"` // e.g. 192.168.0.1 + TargetSshKeyPath string `envconfig:"E2E_SSH_KEY_PATH" required:"true"` // e.g. /Users/username/key.pem + TargetSshUser string `envconfig:"E2E_SSH_USER" required:"true"` // e.g. ubuntu + TargetPort string `envconfig:"E2E_SSH_PORT" default:"22"` +} + +func loadConfig() (*config, error) { + var c config + err := envconfig.Process("", &c) + if err != nil { + return nil, err + } + + return &c, err +} diff --git a/testing/internal/e2e/host/static/statichost_test.go b/testing/internal/e2e/host/static/statichost_test.go index bd2ab6d44..ad012c692 100644 --- a/testing/internal/e2e/host/static/statichost_test.go +++ b/testing/internal/e2e/host/static/statichost_test.go @@ -13,27 +13,9 @@ import ( "github.com/hashicorp/boundary/api/targets" "github.com/hashicorp/boundary/testing/internal/e2e" "github.com/hashicorp/boundary/testing/internal/e2e/boundary" - "github.com/kelseyhightower/envconfig" "github.com/stretchr/testify/require" ) -type config struct { - TargetIp string `envconfig:"E2E_TARGET_IP" required:"true"` // e.g. 192.168.0.1 - TargetSshKeyPath string `envconfig:"E2E_SSH_KEY_PATH" required:"true"` // e.g. /Users/username/key.pem - TargetSshUser string `envconfig:"E2E_SSH_USER" required:"true"` // e.g. ubuntu - TargetPort string `envconfig:"E2E_SSH_PORT" default:"22"` -} - -func loadConfig() (*config, error) { - var c config - err := envconfig.Process("", &c) - if err != nil { - return nil, err - } - - return &c, err -} - // TestConnectTargetCli uses the boundary cli to create a number of supporting objects // to connect to a target. It then attempts to connect to that target and verifies that // the connection was successful.