refact(e2e): Move logging to helper function

This commit is contained in:
Michael Li committed 2022-10-19 10:46:57 -04:00
1 parent 1f87da9fd4
commit 051d337b21
5 files changed
+4 -25

No files matched your search

+4 -9
View File
@@ -22,6 +22,7 @@ func CreateNewOrgApi(t testing.TB, ctx context.Context, client *api.Client) stri
require.NoError(t, err)
})
t.Logf("Created Org Id: %s", newOrgResult.Item.Id)
return newOrgResult.Item.Id
}
@@ -32,11 +33,8 @@ func CreateNewProjectApi(t testing.TB, ctx context.Context, client *api.Client,
scopeClient := scopes.NewClient(client)
newProjResult, err := scopeClient.Create(ctx, orgId, scopes.WithName("e2e Automated Test Project"))
require.NoError(t, err)
t.Cleanup(func() {
_, err := scopeClient.Delete(ctx, newProjResult.Item.Id)
require.NoError(t, err)
})
t.Logf("Created Project Id: %s", newProjResult.Item.Id)
return newProjResult.Item.Id
}
@@ -59,6 +57,7 @@ func CreateNewOrgCli(t testing.TB) string {
require.NoError(t, output.Err, string(output.Stderr))
})
t.Logf("Created Org Id: %s", newOrgResult.Item.Id)
return newOrgResult.Item.Id
}
@@ -77,10 +76,6 @@ func CreateNewProjectCli(t testing.TB, orgId string) string {
err := json.Unmarshal(output.Stdout, &newProjResult)
require.NoError(t, err)
t.Cleanup(func() {
output := e2e.RunCommand("boundary", "scopes", "delete", "-id", newProjResult.Item.Id)
require.NoError(t, output.Err, string(output.Stderr))
})
t.Logf("Created Project Id: %s", newProjResult.Item.Id)
return newProjResult.Item.Id
}
@@ -93,9 +93,7 @@ func TestCreateVaultCredentialStoreCli(t *testing.T) {
// Create an org and project
newOrgId := boundary.CreateNewOrgCli(t)
t.Logf("Created Org Id: %s", newOrgId)
newProjectId := boundary.CreateNewProjectCli(t, newOrgId)
t.Logf("Created Project Id: %s", newProjectId)
// Create a credential store
output = e2e.RunCommand("boundary", "credential-stores", "create", "vault",
@@ -295,9 +293,7 @@ func TestCreateVaultCredentialStoreApi(t *testing.T) {
// Create an org and project
newOrgId := boundary.CreateNewOrgApi(t, ctx, client)
t.Logf("Created Org Id: %s", newOrgId)
newProjectId := boundary.CreateNewProjectApi(t, ctx, client, newOrgId)
t.Logf("Created Project Id: %s", newProjectId)
// Create a credential store
csClient := credentialstores.NewClient(client)
@@ -55,9 +55,7 @@ func TestCreateAwsDynamicHostCatalogCli(t *testing.T) {
// Create an org and project
newOrgId := boundary.CreateNewOrgCli(t)
t.Logf("Created Org Id: %s", newOrgId)
newProjectId := boundary.CreateNewProjectCli(t, newOrgId)
t.Logf("Created Project Id: %s", newProjectId)
// Create a dynamic host catalog
output := e2e.RunCommand("boundary", "host-catalogs", "create", "plugin",
@@ -287,9 +285,7 @@ func TestCreateAwsDynamicHostCatalogApi(t *testing.T) {
// Create an org and project
newOrgId := boundary.CreateNewOrgApi(t, ctx, client)
t.Logf("Created Org Id: %s", newOrgId)
newProjectId := boundary.CreateNewProjectApi(t, ctx, client, newOrgId)
t.Logf("Created Project Id: %s", newProjectId)
// Create a dynamic host catalog
hcClient := hostcatalogs.NewClient(client)
@@ -32,9 +32,7 @@ func TestConnectTargetWithStaticCredentialStoreCli(t *testing.T) {
// Create an org and project
newOrgId := boundary.CreateNewOrgCli(t)
t.Logf("Created Org Id: %s", newOrgId)
newProjectId := boundary.CreateNewProjectCli(t, newOrgId)
t.Logf("Created Project Id: %s", newProjectId)
// Create a credential store
output := e2e.RunCommand("boundary", "credential-stores", "create", "static",
@@ -176,9 +174,7 @@ func TestCreateTargetWithStaticCredentialStoreApi(t *testing.T) {
// Create an org and project
newOrgId := boundary.CreateNewOrgApi(t, ctx, client)
t.Logf("Created Org Id: %s", newOrgId)
newProjectId := boundary.CreateNewProjectApi(t, ctx, client, newOrgId)
t.Logf("Created Project Id: %s", newProjectId)
// Create a credential store
csClient := credentialstores.NewClient(client)
@@ -28,9 +28,7 @@ func TestConnectTargetCli(t *testing.T) {
// Create an org and project
newOrgId := boundary.CreateNewOrgCli(t)
t.Logf("Created Org Id: %s", newOrgId)
newProjectId := boundary.CreateNewProjectCli(t, newOrgId)
t.Logf("Created Project Id: %s", newProjectId)
// Create a host catalog
output := e2e.RunCommand("boundary", "host-catalogs", "create", "static",
@@ -149,9 +147,7 @@ func TestCreateTargetApi(t *testing.T) {
// Create an org and project
newOrgId := boundary.CreateNewOrgApi(t, ctx, client)
t.Logf("Created Org Id: %s", newOrgId)
newProjectId := boundary.CreateNewProjectApi(t, ctx, client, newOrgId)
t.Logf("Created Project Id: %s", newProjectId)
// Create a host catalog
hcClient := hostcatalogs.NewClient(client)