refact(e2e): Add WithEnv option to RunCommand

This was done to keep the scope of environment variables to just the command execution
This commit is contained in:
Michael Li committed 2022-10-25 16:23:52 -04:00
1 parent 1cc2b0b820
commit a956e8dec9
17 files changed
+487 -266

No files matched your search

+17 -9
View File
@@ -45,10 +45,13 @@ func CreateNewProjectApi(t testing.TB, ctx context.Context, client *api.Client,
// Returns the id of the new org.
func CreateNewOrgCli(t testing.TB) string {
ctx := context.Background()
output := e2e.RunCommand(ctx, "boundary", "scopes", "create",
"-name", "e2e Org",
"-scope-id", "global",
"-format", "json",
output := e2e.RunCommand(ctx, "boundary",
e2e.WithArgs(
"scopes", "create",
"-name", "e2e Org",
"-scope-id", "global",
"-format", "json",
),
)
require.NoError(t, output.Err, string(output.Stderr))
@@ -59,7 +62,9 @@ func CreateNewOrgCli(t testing.TB) string {
newOrgId := newOrgResult.Item.Id
t.Cleanup(func() {
AuthenticateAdminCli(t)
output := e2e.RunCommand(ctx, "boundary", "scopes", "delete", "-id", newOrgId)
output := e2e.RunCommand(ctx, "boundary",
e2e.WithArgs("scopes", "delete", "-id", newOrgId),
)
require.NoError(t, output.Err, string(output.Stderr))
})
@@ -72,10 +77,13 @@ func CreateNewOrgCli(t testing.TB) string {
// Returns the id of the new project.
func CreateNewProjectCli(t testing.TB, orgId string) string {
ctx := context.Background()
output := e2e.RunCommand(ctx, "boundary", "scopes", "create",
"-name", "e2e Project",
"-scope-id", orgId,
"-format", "json",
output := e2e.RunCommand(ctx, "boundary",
e2e.WithArgs(
"scopes", "create",
"-name", "e2e Project",
"-scope-id", orgId,
"-format", "json",
),
)
require.NoError(t, output.Err, string(output.Stderr))