chore(e2e): Use region specified in variable (#4814)
This commit is contained in:
1 parent
e0a7c9acdd
commit
a22f031ce0
12 files changed
+17
-7
No files matched your search
@@ -203,7 +203,7 @@ func AddHostToHostSetCli(t testing.TB, ctx context.Context, hostSetId string, ho
|
||||
|
||||
// CreateAwsHostCatalogCli uses the cli to create a new AWS dynamic host catalog.
|
||||
// Returns the id of the new host catalog.
|
||||
func CreateAwsHostCatalogCli(t testing.TB, ctx context.Context, projectId string, accessKeyId string, secretAccessKey string) (string, error) {
|
||||
func CreateAwsHostCatalogCli(t testing.TB, ctx context.Context, projectId, accessKeyId, secretAccessKey, region string) (string, error) {
|
||||
name, err := base62.Random(16)
|
||||
if err != nil {
|
||||
return "", err
|
||||
@@ -215,7 +215,7 @@ func CreateAwsHostCatalogCli(t testing.TB, ctx context.Context, projectId string
|
||||
"-scope-id", projectId,
|
||||
"-plugin-name", "aws",
|
||||
"-attr", "disable_credential_rotation=true",
|
||||
"-attr", "region=us-east-1",
|
||||
"-attr", fmt.Sprintf("region=%s", region),
|
||||
"-secret", "access_key_id=env://E2E_AWS_ACCESS_KEY_ID",
|
||||
"-secret", "secret_access_key=env://E2E_AWS_SECRET_ACCESS_KEY",
|
||||
"-name", fmt.Sprintf("e2e Host Catalog %s", name),
|
||||
|
||||
@@ -38,7 +38,7 @@ func TestCliCreateAwsDynamicHostCatalogWithEmptyHostSet(t *testing.T) {
|
||||
})
|
||||
projectId, err := boundary.CreateProjectCli(t, ctx, orgId)
|
||||
require.NoError(t, err)
|
||||
hostCatalogId, err := boundary.CreateAwsHostCatalogCli(t, ctx, projectId, c.AwsAccessKeyId, c.AwsSecretAccessKey)
|
||||
hostCatalogId, err := boundary.CreateAwsHostCatalogCli(t, ctx, projectId, c.AwsAccessKeyId, c.AwsSecretAccessKey, c.AwsRegion)
|
||||
require.NoError(t, err)
|
||||
|
||||
// Set up a host set
|
||||
|
||||
@@ -43,7 +43,7 @@ func TestCliCreateAwsDynamicHostCatalogWithHostSet(t *testing.T) {
|
||||
})
|
||||
projectId, err := boundary.CreateProjectCli(t, ctx, orgId)
|
||||
require.NoError(t, err)
|
||||
hostCatalogId, err := boundary.CreateAwsHostCatalogCli(t, ctx, projectId, c.AwsAccessKeyId, c.AwsSecretAccessKey)
|
||||
hostCatalogId, err := boundary.CreateAwsHostCatalogCli(t, ctx, projectId, c.AwsAccessKeyId, c.AwsSecretAccessKey, c.AwsRegion)
|
||||
require.NoError(t, err)
|
||||
|
||||
// Set up a host set
|
||||
@@ -178,7 +178,7 @@ func TestApiCreateAwsDynamicHostCatalog(t *testing.T) {
|
||||
hostcatalogs.WithPluginName("aws"),
|
||||
hostcatalogs.WithAttributes(map[string]any{
|
||||
"disable_credential_rotation": true,
|
||||
"region": "us-east-1",
|
||||
"region": c.AwsRegion,
|
||||
}),
|
||||
hostcatalogs.WithSecrets(map[string]any{
|
||||
"access_key_id": c.AwsAccessKeyId,
|
||||
|
||||
@@ -13,6 +13,7 @@ type config struct {
|
||||
AwsAccessKeyId string `envconfig:"E2E_AWS_ACCESS_KEY_ID" required:"true"`
|
||||
AwsSecretAccessKey string `envconfig:"E2E_AWS_SECRET_ACCESS_KEY" required:"true"`
|
||||
AwsHostSetFilter string `envconfig:"E2E_AWS_HOST_SET_FILTER" required:"true"` // e.g. "tag:testtag=true"
|
||||
AwsRegion string `envconfig:"E2E_AWS_REGION" required:"true"` // e.g. "us-east-1"
|
||||
}
|
||||
|
||||
func loadTestConfig() (*config, error) {
|
||||
|
||||
@@ -240,7 +240,7 @@ func populateBoundaryDatabase(t testing.TB, ctx context.Context, c *config, te T
|
||||
require.NoError(t, err)
|
||||
|
||||
// Create AWS dynamic host catalog
|
||||
awsHostCatalogId, err := boundary.CreateAwsHostCatalogCli(t, ctx, projectId, c.AwsAccessKeyId, c.AwsSecretAccessKey)
|
||||
awsHostCatalogId, err := boundary.CreateAwsHostCatalogCli(t, ctx, projectId, c.AwsAccessKeyId, c.AwsSecretAccessKey, c.AwsRegion)
|
||||
require.NoError(t, err)
|
||||
awsHostSetId, err := boundary.CreateAwsHostSetCli(t, ctx, awsHostCatalogId, c.AwsHostSetFilter)
|
||||
require.NoError(t, err)
|
||||
|
||||
Reference in new issue
Block a user