test(e2e): Update migration test with additional resources (#4069)

* test(e2e): Add descriptions to resources

* test(e2e): Add more resources to migration test
pull/4080/head
Michael Li 2 years ago committed by GitHub
parent 798e86cefe
commit 3cae4933c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -47,7 +47,7 @@ func CreateNewAccountCli(t testing.TB, ctx context.Context, authMethodId string,
"-login-name", loginName,
"-password", "env://E2E_TEST_ACCOUNT_PASSWORD",
"-name", "e2e Account "+loginName,
"-description", "e2e Account",
"-description", "e2e",
"-format", "json",
),
e2e.WithEnv("E2E_TEST_ACCOUNT_PASSWORD", password),

@ -36,6 +36,7 @@ func CreateNewCredentialStoreVaultCli(t testing.TB, ctx context.Context, project
"-scope-id", projectId,
"-vault-address", vaultAddr,
"-vault-token", vaultToken,
"-description", "e2e",
"-format", "json",
),
)
@ -56,6 +57,7 @@ func CreateNewCredentialStoreStaticCli(t testing.TB, ctx context.Context, projec
e2e.WithArgs(
"credential-stores", "create", "static",
"-scope-id", projectId,
"-description", "e2e",
"-format", "json",
),
)
@ -79,6 +81,7 @@ func CreateNewStaticCredentialPrivateKeyCli(t testing.TB, ctx context.Context, c
"-credential-store-id", credentialStoreId,
"-username", user,
"-private-key", "file://"+filePath,
"-description", "e2e",
"-format", "json",
),
)
@ -102,6 +105,7 @@ func CreateNewStaticCredentialPasswordCli(t testing.TB, ctx context.Context, cre
"-credential-store-id", credentialStoreId,
"-username", user,
"-password", "env://E2E_CREDENTIALS_PASSWORD",
"-description", "e2e",
"-format", "json",
),
e2e.WithEnv("E2E_CREDENTIALS_PASSWORD", password),
@ -125,6 +129,7 @@ func CreateNewStaticCredentialJsonCli(t testing.TB, ctx context.Context, credent
"credentials", "create", "json",
"-credential-store-id", credentialStoreId,
"-object", "file://"+jsonFilePath,
"-description", "e2e",
"-format", "json",
),
)

@ -20,6 +20,7 @@ func CreateNewGroupCli(t testing.TB, ctx context.Context, scopeId string) string
e2e.WithArgs(
"groups", "create",
"-scope-id", "global",
"-description", "e2e",
"-format", "json",
),
)

@ -74,6 +74,7 @@ func CreateNewHostCatalogCli(t testing.TB, ctx context.Context, projectId string
"host-catalogs", "create", "static",
"-scope-id", projectId,
"-name", "e2e Host Catalog",
"-description", "e2e",
"-format", "json",
),
)
@ -95,6 +96,7 @@ func CreateNewHostSetCli(t testing.TB, ctx context.Context, hostCatalogId string
"host-sets", "create", "static",
"-host-catalog-id", hostCatalogId,
"-name", "e2e Host Set",
"-description", "e2e",
"-format", "json",
),
)
@ -116,6 +118,7 @@ func CreateNewHostCli(t testing.TB, ctx context.Context, hostCatalogId string, a
"hosts", "create", "static",
"-host-catalog-id", hostCatalogId,
"-name", address,
"-description", "e2e",
"-address", address,
"-format", "json",
),
@ -150,6 +153,7 @@ func CreateNewAwsHostCatalogCli(t testing.TB, ctx context.Context, projectId str
"-attr", "region=us-east-1",
"-secret", "access_key_id=env://E2E_AWS_ACCESS_KEY_ID",
"-secret", "secret_access_key=env://E2E_AWS_SECRET_ACCESS_KEY",
"-description", "e2e",
"-format", "json",
),
e2e.WithEnv("E2E_AWS_ACCESS_KEY_ID", accessKeyId),
@ -173,6 +177,7 @@ func CreateNewAwsHostSetCli(t testing.TB, ctx context.Context, hostCatalogId str
"host-sets", "create", "plugin",
"-host-catalog-id", hostCatalogId,
"-attr", "filters="+filter,
"-description", "e2e",
"-format", "json",
),
)

@ -21,6 +21,7 @@ func CreateNewRoleCli(t testing.TB, ctx context.Context, scopeId string) string
"roles", "create",
"-scope-id", scopeId,
"-name", "e2e Role",
"-description", "e2e",
"-format", "json",
),
)

@ -46,6 +46,7 @@ func CreateNewOrgCli(t testing.TB, ctx context.Context) string {
e2e.WithArgs(
"scopes", "create",
"-name", "e2e Org",
"-description", "e2e",
"-scope-id", "global",
"-format", "json",
),
@ -71,6 +72,7 @@ func CreateNewProjectCli(t testing.TB, ctx context.Context, orgId string, opt ..
args = append(args,
"scopes", "create",
"-scope-id", orgId,
"-description", "e2e",
"-format", "json",
)

@ -60,6 +60,7 @@ func CreateNewTargetCli(t testing.TB, ctx context.Context, projectId string, def
args = append(args,
"-scope-id", projectId,
"-default-port", defaultPort,
"-description", "e2e",
"-format", "json",
)

@ -34,7 +34,7 @@ func CreateNewUserCli(t testing.TB, ctx context.Context, scopeId string) string
"users", "create",
"-scope-id", scopeId,
"-name", "e2e User",
"-description", "e2e User",
"-description", "e2e",
"-format", "json",
),
)

@ -16,6 +16,8 @@ import (
"time"
"github.com/hashicorp/boundary/api/credentiallibraries"
"github.com/hashicorp/boundary/api/workers"
"github.com/hashicorp/boundary/internal/target"
"github.com/hashicorp/boundary/testing/internal/e2e"
"github.com/hashicorp/boundary/testing/internal/e2e/boundary"
"github.com/hashicorp/boundary/testing/internal/e2e/infra"
@ -48,7 +50,6 @@ func TestDatabaseMigration(t *testing.T) {
boundaryRepo := "hashicorp/boundary"
boundaryTag := "latest"
te := setupEnvironment(t, ctx, c, boundaryRepo, boundaryTag)
populateBoundaryDatabase(t, ctx, c, te, boundaryRepo, boundaryTag)
@ -201,7 +202,7 @@ func setupEnvironment(t testing.TB, ctx context.Context, c *config, boundaryRepo
func populateBoundaryDatabase(t testing.TB, ctx context.Context, c *config, te TestEnvironment, boundaryRepo, boundaryTag string) {
// Create resources for target. Uses the local CLI so that these methods can be reused.
// While the CLI version used won't necessarily match the controller version, it should be (and is
// supposed to be) backwards ompatible
// supposed to be) backwards compatible
boundary.AuthenticateCli(t, ctx, te.DbInitInfo.AuthMethod.AuthMethodId, te.DbInitInfo.AuthMethod.LoginName, te.DbInitInfo.AuthMethod.Password)
newOrgId := boundary.CreateNewOrgCli(t, ctx)
newProjectId := boundary.CreateNewProjectCli(t, ctx, newOrgId)
@ -212,6 +213,16 @@ func populateBoundaryDatabase(t testing.TB, ctx context.Context, c *config, te T
newTargetId := boundary.CreateNewTargetCli(t, ctx, newProjectId, "2222") // openssh-server uses port 2222
boundary.AddHostSourceToTargetCli(t, ctx, newTargetId, newHostSetId)
// Create a target with an address attached
_ = boundary.CreateNewTargetCli(
t,
ctx,
newProjectId,
"2222",
target.WithName("e2e target with address"),
target.WithAddress(te.Target.UriNetwork),
)
// Create AWS dynamic host catalog
newAwsHostCatalogId := boundary.CreateNewAwsHostCatalogCli(t, ctx, newProjectId, c.AwsAccessKeyId, c.AwsSecretAccessKey)
newAwsHostSetId := boundary.CreateNewAwsHostSetCli(t, ctx, newAwsHostCatalogId, c.AwsHostSetFilter)
@ -275,6 +286,7 @@ func populateBoundaryDatabase(t testing.TB, ctx context.Context, c *config, te T
"-vault-path", c.VaultSecretPath+"/data/"+privateKeySecretName,
"-name", "e2e Automated Test Vault Credential Library",
"-credential-type", "ssh_private_key",
"-description", "e2e",
"-format", "json",
),
)
@ -293,6 +305,7 @@ func populateBoundaryDatabase(t testing.TB, ctx context.Context, c *config, te T
"-vault-path", c.VaultSecretPath+"/data/"+passwordSecretName,
"-name", "e2e Automated Test Vault Credential Library - Password",
"-credential-type", "username_password",
"-description", "e2e",
"-format", "json",
),
)
@ -302,6 +315,22 @@ func populateBoundaryDatabase(t testing.TB, ctx context.Context, c *config, te T
newPasswordCredentialLibraryId := newCredentialLibraryResult.Item.Id
t.Logf("Created Credential Library: %s", newPasswordCredentialLibraryId)
// Create a worker
output = e2e.RunCommand(ctx, "boundary",
e2e.WithArgs(
"workers", "create", "controller-led",
"-name", "e2e worker",
"-description", "e2e",
"-format", "json",
),
)
require.NoError(t, output.Err, string(output.Stderr))
var newWorkerResult workers.WorkerCreateResult
err = json.Unmarshal(output.Stdout, &newWorkerResult)
require.NoError(t, err)
newWorkerId := newWorkerResult.Item.Id
t.Logf("Created Worker: %s", newWorkerId)
// Create a session. Uses Boundary in a docker container to do the connect in order to avoid
// modifying the runner's /etc/hosts file. Otherwise, you would need to add a `127.0.0.1
// localhost boundary` entry into /etc/hosts.

Loading…
Cancel
Save