chore(e2e): update e2e tests to use t.Context() (#6316)

This commit is contained in:
Tony authored and GitHub committed 2026-01-06 17:05:30 -05:00
1 parent fe09f61a85
commit 29ba92e453
71 files changed
+213 -133

No files matched your search

@@ -26,7 +26,7 @@ func TestCliCreateAwsDynamicHostCatalogWithEmptyHostSet(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -36,7 +36,7 @@ func TestCliCreateAwsDynamicHostCatalogWithHostSet(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -189,11 +189,12 @@ func TestApiCreateAwsDynamicHostCatalog(t *testing.T) {
client, err := boundary.NewApiClient()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
orgId, err := boundary.CreateOrgApi(t, ctx, client)
require.NoError(t, err)
t.Cleanup(func() {
ctx := context.Background()
scopeClient := scopes.NewClient(client)
_, err := scopeClient.Delete(ctx, orgId)
require.NoError(t, err)
@@ -20,7 +20,7 @@ func TestCliWorker(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -25,7 +25,7 @@ func TestCliAlias(t *testing.T) {
require.NoError(t, err)
// Set up the test
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -64,6 +64,8 @@ func TestCliAlias(t *testing.T) {
require.NoError(t, err)
aliasTargetAddressId := newAliasResult.Item.Id
t.Cleanup(func() {
ctx := context.Background()
boundary.AuthenticateAdminCli(t, ctx)
output := e2e.RunCommand(ctx, "boundary", e2e.WithArgs("aliases", "delete", "-id", aliasTargetAddressId))
require.NoError(t, output.Err, string(output.Stderr))
})
@@ -148,6 +150,8 @@ func TestCliAlias(t *testing.T) {
require.NoError(t, err)
aliasTargetHostId := newAliasResult.Item.Id
t.Cleanup(func() {
ctx := context.Background()
boundary.AuthenticateAdminCli(t, ctx)
output := e2e.RunCommand(ctx, "boundary", e2e.WithArgs("aliases", "delete", "-id", aliasTargetHostId))
require.NoError(t, output.Err, string(output.Stderr))
})
@@ -26,7 +26,7 @@ import (
func TestCliAuthMethodPassword(t *testing.T) {
e2e.MaybeSkipTest(t)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -153,7 +153,7 @@ func TestCliPaginateAuthMethods(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
client, err := boundary.NewApiClient()
require.NoError(t, err)
@@ -246,7 +246,7 @@ func TestApiPaginateAuthMethods(t *testing.T) {
client, err := boundary.NewApiClient()
require.NoError(t, err)
adminToken := client.Token()
ctx := context.Background()
ctx := t.Context()
sClient := scopes.NewClient(client)
amClient := authmethods.NewClient(client)
orgId, err := boundary.CreateOrgApi(t, ctx, client)
@@ -26,12 +26,13 @@ func TestUserIsLoggedOutWhenAuthTokenIsDeletedCli(t *testing.T) {
bc, err := boundary.LoadConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
accountid, acctPassword, err := boundary.CreateAccountCli(t, ctx, bc.AuthMethodId, testAccountName)
require.NoError(t, err)
t.Cleanup(func() {
boundary.AuthenticateAdminCli(t, context.Background())
ctx := context.Background()
boundary.AuthenticateAdminCli(t, ctx)
output := e2e.RunCommand(ctx, "boundary",
e2e.WithArgs("accounts", "delete", "-id", accountid),
)
@@ -40,7 +41,8 @@ func TestUserIsLoggedOutWhenAuthTokenIsDeletedCli(t *testing.T) {
userId, err := boundary.CreateUserCli(t, ctx, "global")
require.NoError(t, err)
t.Cleanup(func() {
boundary.AuthenticateAdminCli(t, context.Background())
ctx := context.Background()
boundary.AuthenticateAdminCli(t, ctx)
output := e2e.RunCommand(ctx, "boundary",
e2e.WithArgs("users", "delete", "-id", userId),
)
@@ -50,7 +52,7 @@ func TestUserIsLoggedOutWhenAuthTokenIsDeletedCli(t *testing.T) {
require.NoError(t, err)
// Authenticate user and assign a name to its auth token
boundary.AuthenticateCli(t, context.Background(), bc.AuthMethodId, testAccountName, acctPassword,
boundary.AuthenticateCli(t, ctx, bc.AuthMethodId, testAccountName, acctPassword,
e2e.WithArgs("-token-name", testAccountName),
)
@@ -4,7 +4,6 @@
package base_test
import (
"context"
"encoding/json"
"net/http"
"strings"
@@ -20,7 +19,7 @@ import (
func TestCliUnauthenticatedUserAccess(t *testing.T) {
e2e.MaybeSkipTest(t)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
// Check one authenticated request
@@ -5,7 +5,6 @@ package base_test
import (
"bytes"
"context"
"encoding/json"
"io"
"net/http"
@@ -29,7 +28,7 @@ func TestCliAuthenticatePrimary(t *testing.T) {
require.NoError(t, err)
var cmd *exec.Cmd
ctx := context.Background()
ctx := t.Context()
cmd = exec.CommandContext(ctx, "boundary", "authenticate", "-addr", bc.Address, "-format", "json")
f, err := pty.Start(cmd)
@@ -27,7 +27,7 @@ func TestCliBytesUpDownEmpty(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -28,7 +28,7 @@ func TestCliBytesUpDownTransferData(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -40,7 +40,7 @@ func TestCliStaticCredentialStore(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -202,7 +202,7 @@ func TestApiStaticCredentialStore(t *testing.T) {
client, err := boundary.NewApiClient()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
targetPort, err := strconv.ParseUint(c.TargetPort, 10, 32)
require.NoError(t, err)
@@ -210,6 +210,7 @@ func TestApiStaticCredentialStore(t *testing.T) {
orgId, err := boundary.CreateOrgApi(t, ctx, client)
require.NoError(t, err)
t.Cleanup(func() {
ctx := context.Background()
scopeClient := scopes.NewClient(client)
_, err := scopeClient.Delete(ctx, orgId)
require.NoError(t, err)
@@ -29,7 +29,7 @@ func TestCliPaginateAccounts(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
client, err := boundary.NewApiClient()
require.NoError(t, err)
@@ -133,7 +133,7 @@ func TestApiPaginateAccounts(t *testing.T) {
client, err := boundary.NewApiClient()
require.NoError(t, err)
adminToken := client.Token()
ctx := context.Background()
ctx := t.Context()
sClient := scopes.NewClient(client)
amClient := authmethods.NewClient(client)
acClient := accounts.NewClient(client)
@@ -29,7 +29,7 @@ func TestCliPaginateAuthTokens(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
client, err := boundary.NewApiClient()
require.NoError(t, err)
@@ -142,7 +142,7 @@ func TestApiPaginateAuthTokens(t *testing.T) {
client, err := boundary.NewApiClient()
require.NoError(t, err)
adminToken := client.Token()
ctx := context.Background()
ctx := t.Context()
sClient := scopes.NewClient(client)
amClient := authmethods.NewClient(client)
atClient := authtokens.NewClient(client)
@@ -27,7 +27,7 @@ func TestCliPaginateCredentialStores(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -124,7 +124,7 @@ func TestApiPaginateCredentialStores(t *testing.T) {
client, err := boundary.NewApiClient()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
sClient := scopes.NewClient(client)
cClient := credentialstores.NewClient(client)
orgId, err := boundary.CreateOrgApi(t, ctx, client)
@@ -27,7 +27,7 @@ func TestCliPaginateCredentials(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -136,7 +136,7 @@ func TestApiPaginateCredentials(t *testing.T) {
client, err := boundary.NewApiClient()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
sClient := scopes.NewClient(client)
cClient := credentials.NewClient(client)
orgId, err := boundary.CreateOrgApi(t, ctx, client)
@@ -27,7 +27,7 @@ func TestCliPaginateGroups(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -122,7 +122,7 @@ func TestApiPaginateGroups(t *testing.T) {
client, err := boundary.NewApiClient()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
sClient := scopes.NewClient(client)
uClient := groups.NewClient(client)
orgId, err := boundary.CreateOrgApi(t, ctx, client)
@@ -27,7 +27,7 @@ func TestCliPaginateHostCatalogs(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -124,7 +124,7 @@ func TestApiPaginateHostCatalogs(t *testing.T) {
client, err := boundary.NewApiClient()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
sClient := scopes.NewClient(client)
hcClient := hostcatalogs.NewClient(client)
orgId, err := boundary.CreateOrgApi(t, ctx, client)
@@ -27,7 +27,7 @@ func TestCliPaginateHostSets(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -126,7 +126,7 @@ func TestApiPaginateHostSets(t *testing.T) {
client, err := boundary.NewApiClient()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
sClient := scopes.NewClient(client)
hsClient := hostsets.NewClient(client)
orgId, err := boundary.CreateOrgApi(t, ctx, client)
@@ -27,7 +27,7 @@ func TestCliPaginateHosts(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -126,7 +126,7 @@ func TestApiPaginateHosts(t *testing.T) {
client, err := boundary.NewApiClient()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
sClient := scopes.NewClient(client)
hClient := hosts.NewClient(client)
orgId, err := boundary.CreateOrgApi(t, ctx, client)
@@ -28,7 +28,7 @@ func TestCliPaginateManagedGroups(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
client, err := boundary.NewApiClient()
require.NoError(t, err)
@@ -132,7 +132,7 @@ func TestApiPaginateManagedGroups(t *testing.T) {
client, err := boundary.NewApiClient()
require.NoError(t, err)
adminToken := client.Token()
ctx := context.Background()
ctx := t.Context()
sClient := scopes.NewClient(client)
amClient := authmethods.NewClient(client)
mgClient := managedgroups.NewClient(client)
@@ -27,7 +27,7 @@ func TestCliPaginateRoles(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -127,7 +127,7 @@ func TestApiPaginateRoles(t *testing.T) {
client, err := boundary.NewApiClient()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
sClient := scopes.NewClient(client)
uClient := roles.NewClient(client)
orgId, err := boundary.CreateOrgApi(t, ctx, client)
@@ -25,7 +25,7 @@ func TestCliPaginateScopes(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -120,7 +120,7 @@ func TestApiPaginateScopes(t *testing.T) {
client, err := boundary.NewApiClient()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
sClient := scopes.NewClient(client)
orgId, err := boundary.CreateOrgApi(t, ctx, client)
require.NoError(t, err)
@@ -27,7 +27,7 @@ func TestCliPaginateSessions(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -113,7 +113,7 @@ func TestApiPaginateSessions(t *testing.T) {
client, err := boundary.NewApiClient()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
orgId, err := boundary.CreateOrgApi(t, ctx, client)
require.NoError(t, err)
sClient := sessions.NewClient(client)
@@ -29,7 +29,7 @@ func TestCliPaginateTargets(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -134,7 +134,7 @@ func TestApiPaginateTargets(t *testing.T) {
client, err := boundary.NewApiClient()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
sClient := scopes.NewClient(client)
tClient := targets.NewClient(client)
orgId, err := boundary.CreateOrgApi(t, ctx, client)
@@ -27,7 +27,7 @@ func TestCliPaginateUsers(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -122,7 +122,7 @@ func TestApiPaginateUsers(t *testing.T) {
client, err := boundary.NewApiClient()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
sClient := scopes.NewClient(client)
uClient := users.NewClient(client)
orgId, err := boundary.CreateOrgApi(t, ctx, client)
@@ -18,7 +18,7 @@ func TestCliApplyGrantsForMultipleScopes(t *testing.T) {
bc, err := boundary.LoadConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
// Create Org and Project
@@ -38,6 +38,7 @@ func TestCliApplyGrantsForMultipleScopes(t *testing.T) {
accountId, acctPassword, err := boundary.CreateAccountCli(t, ctx, bc.AuthMethodId, acctName)
require.NoError(t, err)
t.Cleanup(func() {
ctx := context.Background()
boundary.AuthenticateAdminCli(t, ctx)
output := e2e.RunCommand(ctx, "boundary",
e2e.WithArgs("accounts", "delete", "-id", accountId),
@@ -49,6 +50,7 @@ func TestCliApplyGrantsForMultipleScopes(t *testing.T) {
userId, err := boundary.CreateUserCli(t, ctx, "global")
require.NoError(t, err)
t.Cleanup(func() {
ctx := context.Background()
boundary.AuthenticateAdminCli(t, ctx)
output := e2e.RunCommand(ctx, "boundary",
e2e.WithArgs("users", "delete", "-id", userId),
@@ -78,6 +80,7 @@ func TestCliApplyGrantsForMultipleScopes(t *testing.T) {
roleId, err := boundary.CreateRoleCli(t, ctx, "global")
require.NoError(t, err)
t.Cleanup(func() {
ctx := context.Background()
boundary.AuthenticateAdminCli(t, ctx)
output := e2e.RunCommand(ctx, "boundary",
e2e.WithArgs("roles", "delete", "-id", roleId),
@@ -24,7 +24,7 @@ func TestScopePermissions(t *testing.T) {
bc, err := boundary.LoadConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
// Create Org and 2 Projects
@@ -46,6 +46,7 @@ func TestScopePermissions(t *testing.T) {
accountId, acctPassword, err := boundary.CreateAccountCli(t, ctx, bc.AuthMethodId, testAccountName)
require.NoError(t, err)
t.Cleanup(func() {
ctx := context.Background()
boundary.AuthenticateAdminCli(t, ctx)
output := e2e.RunCommand(ctx, "boundary",
e2e.WithArgs("accounts", "delete", "-id", accountId),
@@ -57,6 +58,7 @@ func TestScopePermissions(t *testing.T) {
userId, err := boundary.CreateUserCli(t, ctx, "global")
require.NoError(t, err)
t.Cleanup(func() {
ctx := context.Background()
boundary.AuthenticateAdminCli(t, ctx)
output := e2e.RunCommand(ctx, "boundary",
e2e.WithArgs("users", "delete", "-id", userId),
@@ -108,6 +110,7 @@ func TestScopePermissions(t *testing.T) {
require.NoError(t, output.Err, string(output.Stderr))
t.Cleanup(func() {
ctx := context.Background()
boundary.AuthenticateAdminCli(t, ctx)
output := e2e.RunCommand(ctx, "boundary",
e2e.WithArgs("roles", "remove-grants", "-id", loginGrantsRoleId, "-grant", "ids=*;type=scope;actions=list"))
@@ -124,6 +127,7 @@ func TestScopePermissions(t *testing.T) {
require.NoError(t, output.Err, string(output.Stderr))
t.Cleanup(func() {
ctx := context.Background()
boundary.AuthenticateAdminCli(t, ctx)
output := e2e.RunCommand(ctx, "boundary",
e2e.WithArgs("roles", "add-grants", "-id", authenticatedUserGrantsRoleId, "-grant", "ids=*;type=scope;actions=read"),
@@ -31,7 +31,7 @@ func TestCliSearch(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
// If cache is already running, stop it so that we can start it with a
// shorter refresh interval
@@ -50,6 +50,7 @@ func TestCliSearch(t *testing.T) {
)
require.NoError(t, output.Err, string(output.Stderr))
t.Cleanup(func() {
ctx := context.Background()
output := e2e.RunCommand(ctx, "boundary", e2e.WithArgs("cache", "stop"))
require.NoError(t, output.Err, string(output.Stderr))
})
@@ -21,7 +21,7 @@ func TestCliSessionCancelAdmin(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -34,7 +34,7 @@ func TestCliSessionCancelGroup(t *testing.T) {
bc, err := boundary.LoadConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -62,7 +62,8 @@ func TestCliSessionCancelGroup(t *testing.T) {
accountId, acctPassword, err := boundary.CreateAccountCli(t, ctx, bc.AuthMethodId, acctName)
require.NoError(t, err)
t.Cleanup(func() {
boundary.AuthenticateAdminCli(t, context.Background())
ctx := context.Background()
boundary.AuthenticateAdminCli(t, ctx)
output := e2e.RunCommand(ctx, "boundary",
e2e.WithArgs("accounts", "delete", "-id", accountId),
)
@@ -71,7 +72,8 @@ func TestCliSessionCancelGroup(t *testing.T) {
userId, err := boundary.CreateUserCli(t, ctx, "global")
require.NoError(t, err)
t.Cleanup(func() {
boundary.AuthenticateAdminCli(t, context.Background())
ctx := context.Background()
boundary.AuthenticateAdminCli(t, ctx)
output := e2e.RunCommand(ctx, "boundary",
e2e.WithArgs("users", "delete", "-id", userId),
)
@@ -180,7 +182,7 @@ func TestApiCreateGroup(t *testing.T) {
client, err := boundary.NewApiClient()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
targetPort, err := strconv.ParseUint(c.TargetPort, 10, 32)
require.NoError(t, err)
@@ -188,6 +190,7 @@ func TestApiCreateGroup(t *testing.T) {
orgId, err := boundary.CreateOrgApi(t, ctx, client)
require.NoError(t, err)
t.Cleanup(func() {
ctx := context.Background()
scopeClient := scopes.NewClient(client)
_, err := scopeClient.Delete(ctx, orgId)
require.NoError(t, err)
@@ -211,6 +214,7 @@ func TestApiCreateGroup(t *testing.T) {
accountId, _, err := boundary.CreateAccountApi(t, ctx, client, bc.AuthMethodId, acctName)
require.NoError(t, err)
t.Cleanup(func() {
ctx := context.Background()
aClient := accounts.NewClient(client)
_, err := aClient.Delete(ctx, accountId)
require.NoError(t, err)
@@ -218,6 +222,7 @@ func TestApiCreateGroup(t *testing.T) {
userId, err := boundary.CreateUserApi(t, ctx, client, "global")
require.NoError(t, err)
t.Cleanup(func() {
ctx := context.Background()
uClient := users.NewClient(client)
_, err := uClient.Delete(ctx, userId)
require.NoError(t, err)
@@ -33,7 +33,7 @@ func TestCliSessionCancelUser(t *testing.T) {
bc, err := boundary.LoadConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -61,7 +61,8 @@ func TestCliSessionCancelUser(t *testing.T) {
accountId, acctPassword, err := boundary.CreateAccountCli(t, ctx, bc.AuthMethodId, acctName)
require.NoError(t, err)
t.Cleanup(func() {
boundary.AuthenticateAdminCli(t, context.Background())
ctx := context.Background()
boundary.AuthenticateAdminCli(t, ctx)
output := e2e.RunCommand(ctx, "boundary",
e2e.WithArgs("accounts", "delete", "-id", accountId),
)
@@ -70,7 +71,8 @@ func TestCliSessionCancelUser(t *testing.T) {
userId, err := boundary.CreateUserCli(t, ctx, "global")
require.NoError(t, err)
t.Cleanup(func() {
boundary.AuthenticateAdminCli(t, context.Background())
ctx := context.Background()
boundary.AuthenticateAdminCli(t, ctx)
output := e2e.RunCommand(ctx, "boundary",
e2e.WithArgs("users", "delete", "-id", userId),
)
@@ -173,7 +175,7 @@ func TestApiCreateUser(t *testing.T) {
client, err := boundary.NewApiClient()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
targetPort, err := strconv.ParseUint(c.TargetPort, 10, 32)
require.NoError(t, err)
@@ -181,6 +183,7 @@ func TestApiCreateUser(t *testing.T) {
orgId, err := boundary.CreateOrgApi(t, ctx, client)
require.NoError(t, err)
t.Cleanup(func() {
ctx := context.Background()
scopeClient := scopes.NewClient(client)
_, err := scopeClient.Delete(ctx, orgId)
require.NoError(t, err)
@@ -204,6 +207,7 @@ func TestApiCreateUser(t *testing.T) {
accountId, _, err := boundary.CreateAccountApi(t, ctx, client, bc.AuthMethodId, acctName)
require.NoError(t, err)
t.Cleanup(func() {
ctx := context.Background()
aClient := accounts.NewClient(client)
_, err := aClient.Delete(ctx, accountId)
require.NoError(t, err)
@@ -211,6 +215,7 @@ func TestApiCreateUser(t *testing.T) {
userId, err := boundary.CreateUserApi(t, ctx, client, "global")
require.NoError(t, err)
t.Cleanup(func() {
ctx := context.Background()
uClient := users.NewClient(client)
_, err := uClient.Delete(ctx, userId)
require.NoError(t, err)
@@ -24,7 +24,7 @@ func TestCliSessionEndWhenHostSetIsDeleted(t *testing.T) {
bc, err := boundary.LoadConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -52,7 +52,8 @@ func TestCliSessionEndWhenHostSetIsDeleted(t *testing.T) {
accountId, acctPassword, err := boundary.CreateAccountCli(t, ctx, bc.AuthMethodId, acctName)
require.NoError(t, err)
t.Cleanup(func() {
boundary.AuthenticateAdminCli(t, context.Background())
ctx := context.Background()
boundary.AuthenticateAdminCli(t, ctx)
output := e2e.RunCommand(ctx, "boundary",
e2e.WithArgs("accounts", "delete", "-id", accountId),
)
@@ -61,7 +62,8 @@ func TestCliSessionEndWhenHostSetIsDeleted(t *testing.T) {
userId, err := boundary.CreateUserCli(t, ctx, "global")
require.NoError(t, err)
t.Cleanup(func() {
boundary.AuthenticateAdminCli(t, context.Background())
ctx := context.Background()
boundary.AuthenticateAdminCli(t, ctx)
output := e2e.RunCommand(ctx, "boundary",
e2e.WithArgs("users", "delete", "-id", userId),
)
@@ -24,7 +24,7 @@ func TestCliSessionEndWhenHostIsDeleted(t *testing.T) {
bc, err := boundary.LoadConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -52,7 +52,8 @@ func TestCliSessionEndWhenHostIsDeleted(t *testing.T) {
accountId, acctPassword, err := boundary.CreateAccountCli(t, ctx, bc.AuthMethodId, acctName)
require.NoError(t, err)
t.Cleanup(func() {
boundary.AuthenticateAdminCli(t, context.Background())
ctx := context.Background()
boundary.AuthenticateAdminCli(t, ctx)
output := e2e.RunCommand(ctx, "boundary",
e2e.WithArgs("accounts", "delete", "-id", accountId),
)
@@ -61,7 +62,8 @@ func TestCliSessionEndWhenHostIsDeleted(t *testing.T) {
userId, err := boundary.CreateUserCli(t, ctx, "global")
require.NoError(t, err)
t.Cleanup(func() {
boundary.AuthenticateAdminCli(t, context.Background())
ctx := context.Background()
boundary.AuthenticateAdminCli(t, ctx)
output := e2e.RunCommand(ctx, "boundary",
e2e.WithArgs("users", "delete", "-id", userId),
)
@@ -25,7 +25,7 @@ func TestCliSessionEndWhenProjectIsDeleted(t *testing.T) {
bc, err := boundary.LoadConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -43,7 +43,8 @@ func TestCliSessionEndWhenProjectIsDeleted(t *testing.T) {
accountId, acctPassword, err := boundary.CreateAccountCli(t, ctx, bc.AuthMethodId, acctName)
require.NoError(t, err)
t.Cleanup(func() {
boundary.AuthenticateAdminCli(t, context.Background())
ctx := context.Background()
boundary.AuthenticateAdminCli(t, ctx)
output := e2e.RunCommand(ctx, "boundary",
e2e.WithArgs("accounts", "delete", "-id", accountId),
)
@@ -52,7 +53,8 @@ func TestCliSessionEndWhenProjectIsDeleted(t *testing.T) {
userId, err := boundary.CreateUserCli(t, ctx, "global")
require.NoError(t, err)
t.Cleanup(func() {
boundary.AuthenticateAdminCli(t, context.Background())
ctx := context.Background()
boundary.AuthenticateAdminCli(t, ctx)
output := e2e.RunCommand(ctx, "boundary",
e2e.WithArgs("users", "delete", "-id", userId),
)
@@ -24,7 +24,7 @@ func TestCliSessionEndWhenTargetIsDeleted(t *testing.T) {
bc, err := boundary.LoadConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -52,7 +52,8 @@ func TestCliSessionEndWhenTargetIsDeleted(t *testing.T) {
accountId, acctPassword, err := boundary.CreateAccountCli(t, ctx, bc.AuthMethodId, acctName)
require.NoError(t, err)
t.Cleanup(func() {
boundary.AuthenticateAdminCli(t, context.Background())
ctx := context.Background()
boundary.AuthenticateAdminCli(t, ctx)
output := e2e.RunCommand(ctx, "boundary",
e2e.WithArgs("accounts", "delete", "-id", accountId),
)
@@ -61,7 +62,8 @@ func TestCliSessionEndWhenTargetIsDeleted(t *testing.T) {
userId, err := boundary.CreateUserCli(t, ctx, "global")
require.NoError(t, err)
t.Cleanup(func() {
boundary.AuthenticateAdminCli(t, context.Background())
ctx := context.Background()
boundary.AuthenticateAdminCli(t, ctx)
output := e2e.RunCommand(ctx, "boundary",
e2e.WithArgs("users", "delete", "-id", userId),
)
@@ -26,7 +26,7 @@ func TestCliSessionEndWhenUserIsDeleted(t *testing.T) {
bc, err := boundary.LoadConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -54,7 +54,8 @@ func TestCliSessionEndWhenUserIsDeleted(t *testing.T) {
accountId, acctPassword, err := boundary.CreateAccountCli(t, ctx, bc.AuthMethodId, acctName)
require.NoError(t, err)
t.Cleanup(func() {
boundary.AuthenticateAdminCli(t, context.Background())
ctx := context.Background()
boundary.AuthenticateAdminCli(t, ctx)
output := e2e.RunCommand(ctx, "boundary",
e2e.WithArgs("accounts", "delete", "-id", accountId),
)
@@ -63,9 +64,10 @@ func TestCliSessionEndWhenUserIsDeleted(t *testing.T) {
userId, err := boundary.CreateUserCli(t, ctx, "global")
require.NoError(t, err)
t.Cleanup(func() {
ctx := context.Background()
if !userIsDeleted {
t.Log("Deleting user...")
boundary.AuthenticateAdminCli(t, context.Background())
boundary.AuthenticateAdminCli(t, ctx)
output := e2e.RunCommand(ctx, "boundary",
e2e.WithArgs("users", "delete", "-id", userId),
)
@@ -23,7 +23,7 @@ func TestCliCreateUpdateTargetAddress(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -141,7 +141,7 @@ func TestCliTargetAddressToHostSource(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -267,7 +267,7 @@ func TestCliTargetHostSourceToAddress(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -27,7 +27,7 @@ func TestCliTcpTargetConnectTargetWithAuthzToken(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -32,7 +32,7 @@ func TestCliTcpTargetConnectCassandra(t *testing.T) {
// Increase timeout to accommodate Cassandra's longer startup duration due to gossip needing to settle
pool.MaxWait = 90 * time.Second
ctx := context.Background()
ctx := t.Context()
// e2e_cluster network is created by the e2e infra setup
network, err := pool.NetworksByName("e2e_cluster")
@@ -25,7 +25,7 @@ func TestCliTcpTargetConnectTargetWithConnectionLimits(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -22,7 +22,7 @@ func TestCliTcpTargetConnectTargetWithTargetClientPort(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -24,7 +24,7 @@ func TestCliTcpTargetConnectExecLongLastingScript(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
// Create test organization
@@ -23,7 +23,7 @@ func TestCliTcpTargetConnectGoSsh(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -26,11 +26,12 @@ func TestCliTcpTargetConnectHttp(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
t.Cleanup(func() {
ctx := context.Background()
output := e2e.RunCommand(ctx, "boundary", e2e.WithArgs("scopes", "delete", "-id", orgId))
require.NoError(t, output.Err, string(output.Stderr))
})
@@ -23,7 +23,7 @@ func TestCliTcpTargetConnectListenPort(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -84,7 +84,7 @@ func TestCliTcpTargetConnectDefaultClientPort(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -23,7 +23,7 @@ func TestCliTcpTargetConnectTargetWithLocalhost(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -24,7 +24,7 @@ import (
// target using `connect mongo`
func TestCliTcpTargetConnectMongo(t *testing.T) {
e2e.MaybeSkipTest(t)
ctx := context.Background()
ctx := t.Context()
pool, err := dockertest.NewPool("")
require.NoError(t, err)
@@ -24,7 +24,7 @@ import (
// target using `connect mysql`
func TestCliTcpTargetConnectMysql(t *testing.T) {
e2e.MaybeSkipTest(t)
ctx := context.Background()
ctx := t.Context()
pool, err := dockertest.NewPool("")
require.NoError(t, err)
@@ -22,7 +22,7 @@ func TestCliTcpTargetConnectRedisPassword(t *testing.T) {
e2e.MaybeSkipTest(t)
// Setup
ctx := context.Background()
ctx := t.Context()
redisInfo := infra.SetupRedisContainer(t)
boundary.AuthenticateAdminCli(t, ctx)
@@ -22,7 +22,7 @@ func TestCliTcpTargetConnectRedisUsernamePassword(t *testing.T) {
e2e.MaybeSkipTest(t)
// Setup
ctx := context.Background()
ctx := t.Context()
redisInfo := infra.SetupRedisContainer(t)
boundary.AuthenticateAdminCli(t, ctx)
@@ -26,7 +26,7 @@ func TestCliTcpTargetConnectTargetAndScp(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -23,7 +23,7 @@ func TestCliTcpTargetConnectTargetWithSessionMaxSecondsTearDown(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -97,7 +97,7 @@ func TestCliTcpTargetConnectTargetWithSessionMaxSecondsRejectNew(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -24,7 +24,7 @@ func TestCliTcpTargetConnectTargetWithSsh(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -23,7 +23,7 @@ func TestCliTcpTargetConnectTargetBasic(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -81,7 +81,7 @@ func TestCliTcpTargetConnectTargetViaTargetAndScopeNames(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -4,7 +4,6 @@
package base_test
import (
"context"
"encoding/json"
"strconv"
"strings"
@@ -20,7 +19,7 @@ import (
func TestCliVersion(t *testing.T) {
e2e.MaybeSkipTest(t)
ctx := context.Background()
ctx := t.Context()
output := e2e.RunCommand(ctx, "boundary", e2e.WithArgs("version", "-format", "json"))
require.NoError(t, output.Err, string(output.Stderr))
@@ -26,7 +26,7 @@ func TestCliLdap(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -5,7 +5,6 @@ package base_plus_test
import (
"bytes"
"context"
"encoding/json"
"fmt"
"io"
@@ -27,7 +26,7 @@ import (
// daemon tried to access the keyring when there wasn't one on the system.
func TestCliAuthenticateNoKeyring(t *testing.T) {
e2e.MaybeSkipTest(t)
ctx := context.Background()
ctx := t.Context()
bc, err := boundary.LoadConfig()
require.NoError(t, err)
@@ -22,7 +22,7 @@ import (
func TestCliKeyDestruction(t *testing.T) {
e2e.MaybeSkipTest(t)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
t.Log("Creating scope...")
@@ -38,6 +38,7 @@ func TestCliKeyDestruction(t *testing.T) {
var scopeReply scopes.ScopeCreateResult
require.NoError(t, json.Unmarshal(output.Stdout, &scopeReply))
t.Cleanup(func() {
ctx := context.Background()
output = e2e.RunCommand(ctx, "boundary",
e2e.WithArgs(
"scopes", "delete",
@@ -81,6 +82,7 @@ func TestCliKeyDestruction(t *testing.T) {
var amReply authmethods.AuthMethodCreateResult
require.NoError(t, json.Unmarshal(output.Stdout, &amReply))
t.Cleanup(func() {
ctx := context.Background()
output = e2e.RunCommand(ctx, "boundary",
e2e.WithArgs(
"auth-methods", "delete",
@@ -244,7 +246,7 @@ func TestApiKeyDestruction(t *testing.T) {
client, err := boundary.NewApiClient()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
sc := scopes.NewClient(client)
t.Log("Creating scope...")
@@ -31,7 +31,7 @@ func TestHttpRateLimit(t *testing.T) {
bc, err := boundary.LoadConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -168,7 +168,8 @@ func TestHttpRateLimit(t *testing.T) {
accountId, acctPassword, err := boundary.CreateAccountCli(t, ctx, bc.AuthMethodId, acctName)
require.NoError(t, err)
t.Cleanup(func() {
boundary.AuthenticateAdminCli(t, context.Background())
ctx := context.Background()
boundary.AuthenticateAdminCli(t, ctx)
output := e2e.RunCommand(ctx, "boundary",
e2e.WithArgs("accounts", "delete", "-id", accountId),
)
@@ -177,7 +178,8 @@ func TestHttpRateLimit(t *testing.T) {
userId, err := boundary.CreateUserCli(t, ctx, "global")
require.NoError(t, err)
t.Cleanup(func() {
boundary.AuthenticateAdminCli(t, context.Background())
ctx := context.Background()
boundary.AuthenticateAdminCli(t, ctx)
output := e2e.RunCommand(ctx, "boundary",
e2e.WithArgs("users", "delete", "-id", userId),
)
@@ -303,7 +305,7 @@ func TestCliRateLimit(t *testing.T) {
bc, err := boundary.LoadConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
@@ -326,7 +328,8 @@ func TestCliRateLimit(t *testing.T) {
accountId, acctPassword, err := boundary.CreateAccountCli(t, ctx, bc.AuthMethodId, acctName)
require.NoError(t, err)
t.Cleanup(func() {
boundary.AuthenticateAdminCli(t, context.Background())
ctx := context.Background()
boundary.AuthenticateAdminCli(t, ctx)
output := e2e.RunCommand(ctx, "boundary",
e2e.WithArgs("accounts", "delete", "-id", accountId),
)
@@ -335,7 +338,8 @@ func TestCliRateLimit(t *testing.T) {
userId, err := boundary.CreateUserCli(t, ctx, "global")
require.NoError(t, err)
t.Cleanup(func() {
boundary.AuthenticateAdminCli(t, context.Background())
ctx := context.Background()
boundary.AuthenticateAdminCli(t, ctx)
output := e2e.RunCommand(ctx, "boundary",
e2e.WithArgs("users", "delete", "-id", userId),
)
@@ -25,7 +25,7 @@ func TestCliTcpTargetConnectPostgres(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -31,7 +31,7 @@ func TestAuthMethodOidcVault(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
t.Log("Setting up Vault OIDC provider...")
// Configure vault authentication: Enable the userpass auth method at the
@@ -39,6 +39,7 @@ func TestAuthMethodOidcVault(t *testing.T) {
output := e2e.RunCommand(ctx, "vault", e2e.WithArgs("auth", "enable", "userpass"))
require.NoError(t, output.Err, string(output.Stderr))
t.Cleanup(func() {
ctx := context.Background()
output := e2e.RunCommand(ctx, "vault", e2e.WithArgs("auth", "disable", "userpass"))
require.NoError(t, output.Err, string(output.Stderr))
})
@@ -56,6 +57,7 @@ func TestAuthMethodOidcVault(t *testing.T) {
require.NoError(t, err)
authPolicyName := vault.WritePolicy(t, ctx, authPolicyPath)
t.Cleanup(func() {
ctx := context.Background()
output := e2e.RunCommand(ctx, "vault",
e2e.WithArgs("policy", "delete", authPolicyName),
)
@@ -67,7 +67,8 @@ func TestApiVaultLdapCredentialLibrary(t *testing.T) {
// Configure Vault for LDAP.
boundaryPolicyName := vault.SetupForBoundaryController(t, "testdata/boundary-controller-policy.hcl")
t.Cleanup(func() {
output := e2e.RunCommand(context.Background(), "vault",
ctx := context.Background()
output := e2e.RunCommand(ctx, "vault",
e2e.WithArgs("policy", "delete", boundaryPolicyName),
)
require.NoError(t, output.Err, string(output.Stderr))
@@ -78,13 +79,14 @@ func TestApiVaultLdapCredentialLibrary(t *testing.T) {
c.LdapDomainDn, c.LdapUserName, c.LdapGroupName,
)
t.Cleanup(func() {
ctx := context.Background()
// Destroy LDAP secrets engine and LDAP policy.
output := e2e.RunCommand(context.Background(), "vault",
output := e2e.RunCommand(ctx, "vault",
e2e.WithArgs("secrets", "disable", c.VaultLdapPath),
)
require.NoError(t, output.Err, string(output.Stderr))
output = e2e.RunCommand(context.Background(), "vault",
output = e2e.RunCommand(ctx, "vault",
e2e.WithArgs("policy", "delete", ldapPolicyName),
)
require.NoError(t, output.Err, string(output.Stderr))
@@ -215,8 +217,9 @@ func TestCliVaultLdapCredentialLibrary(t *testing.T) {
orgId, err := boundary.CreateOrgCli(t, t.Context())
require.NoError(t, err)
t.Cleanup(func() {
boundary.AuthenticateAdminCli(t, context.Background())
output := e2e.RunCommand(context.Background(), "boundary", e2e.WithArgs("scopes", "delete", "-id", orgId))
ctx := context.Background()
boundary.AuthenticateAdminCli(t, ctx)
output := e2e.RunCommand(ctx, "boundary", e2e.WithArgs("scopes", "delete", "-id", orgId))
require.NoError(t, output.Err, string(output.Stderr))
})
@@ -238,7 +241,8 @@ func TestCliVaultLdapCredentialLibrary(t *testing.T) {
// Configure Vault for LDAP.
boundaryPolicyName := vault.SetupForBoundaryController(t, "testdata/boundary-controller-policy.hcl")
t.Cleanup(func() {
output := e2e.RunCommand(context.Background(), "vault",
ctx := context.Background()
output := e2e.RunCommand(ctx, "vault",
e2e.WithArgs("policy", "delete", boundaryPolicyName),
)
require.NoError(t, output.Err, string(output.Stderr))
@@ -249,13 +253,14 @@ func TestCliVaultLdapCredentialLibrary(t *testing.T) {
c.LdapDomainDn, c.LdapUserName, c.LdapGroupName,
)
t.Cleanup(func() {
ctx := context.Background()
// Destroy LDAP secrets engine and LDAP policy.
output := e2e.RunCommand(context.Background(), "vault",
output := e2e.RunCommand(ctx, "vault",
e2e.WithArgs("secrets", "disable", c.VaultLdapPath),
)
require.NoError(t, output.Err, string(output.Stderr))
output = e2e.RunCommand(context.Background(), "vault",
output = e2e.RunCommand(ctx, "vault",
e2e.WithArgs("policy", "delete", ldapPolicyName),
)
require.NoError(t, output.Err, string(output.Stderr))
@@ -29,7 +29,7 @@ func TestCliVaultCredentialStore(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -57,6 +57,7 @@ func TestCliVaultCredentialStore(t *testing.T) {
// Configure vault
boundaryPolicyName := vault.SetupForBoundaryController(t, "testdata/boundary-controller-policy.hcl")
t.Cleanup(func() {
ctx := context.Background()
output := e2e.RunCommand(ctx, "vault",
e2e.WithArgs("policy", "delete", boundaryPolicyName),
)
@@ -68,6 +69,7 @@ func TestCliVaultCredentialStore(t *testing.T) {
)
require.NoError(t, output.Err, string(output.Stderr))
t.Cleanup(func() {
ctx := context.Background()
output := e2e.RunCommand(ctx, "vault",
e2e.WithArgs("secrets", "disable", c.VaultSecretPath),
)
@@ -77,6 +79,7 @@ func TestCliVaultCredentialStore(t *testing.T) {
// Create credentials in vault
privateKeySecretName, privateKeyPolicyName := vault.CreateKvPrivateKeyCredential(t, c.VaultSecretPath, c.TargetSshUser, c.TargetSshKeyPath)
t.Cleanup(func() {
ctx := context.Background()
output := e2e.RunCommand(ctx, "vault",
e2e.WithArgs("policy", "delete", privateKeyPolicyName),
)
@@ -85,6 +88,7 @@ func TestCliVaultCredentialStore(t *testing.T) {
passwordSecretName, passwordPolicyName, password := vault.CreateKvPasswordCredential(t, c.VaultSecretPath, c.TargetSshUser)
t.Cleanup(func() {
ctx := context.Background()
output := e2e.RunCommand(ctx, "vault",
e2e.WithArgs("policy", "delete", passwordPolicyName),
)
@@ -93,6 +97,7 @@ func TestCliVaultCredentialStore(t *testing.T) {
domainSecretName, domainPolicyName, domainPassword := vault.CreateKvPasswordDomainCredential(t, c.VaultSecretPath, c.TargetSshUser, "domain.com")
t.Cleanup(func() {
ctx := context.Background()
output := e2e.RunCommand(ctx, "vault",
e2e.WithArgs("policy", "delete", domainPolicyName),
)
@@ -230,7 +235,7 @@ func TestApiVaultCredentialStore(t *testing.T) {
client, err := boundary.NewApiClient()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
targetPort, err := strconv.ParseUint(c.TargetPort, 10, 32)
require.NoError(t, err)
@@ -238,6 +243,7 @@ func TestApiVaultCredentialStore(t *testing.T) {
orgId, err := boundary.CreateOrgApi(t, ctx, client)
require.NoError(t, err)
t.Cleanup(func() {
ctx := context.Background()
scopeClient := scopes.NewClient(client)
_, err := scopeClient.Delete(ctx, orgId)
require.NoError(t, err)
@@ -264,6 +270,7 @@ func TestApiVaultCredentialStore(t *testing.T) {
)
require.NoError(t, output.Err, string(output.Stderr))
t.Cleanup(func() {
ctx := context.Background()
output := e2e.RunCommand(ctx, "vault",
e2e.WithArgs("secrets", "disable", c.VaultSecretPath),
)
@@ -273,6 +280,7 @@ func TestApiVaultCredentialStore(t *testing.T) {
// Create credentials in vault
privateKeySecretName, privateKeyPolicyName := vault.CreateKvPrivateKeyCredential(t, c.VaultSecretPath, c.TargetSshUser, c.TargetSshKeyPath)
t.Cleanup(func() {
ctx := context.Background()
output := e2e.RunCommand(ctx, "vault",
e2e.WithArgs("policy", "delete", privateKeyPolicyName),
)
@@ -281,6 +289,7 @@ func TestApiVaultCredentialStore(t *testing.T) {
passwordSecretName, passwordPolicyName, password := vault.CreateKvPasswordCredential(t, c.VaultSecretPath, c.TargetSshUser)
t.Cleanup(func() {
ctx := context.Background()
output := e2e.RunCommand(ctx, "vault",
e2e.WithArgs("policy", "delete", passwordPolicyName),
)
@@ -289,6 +298,7 @@ func TestApiVaultCredentialStore(t *testing.T) {
domainSecretName, domainPolicyName, domainPassword := vault.CreateKvPasswordDomainCredential(t, c.VaultSecretPath, c.TargetSshUser, "domain.com")
t.Cleanup(func() {
ctx := context.Background()
output := e2e.RunCommand(ctx, "vault",
e2e.WithArgs("policy", "delete", domainPolicyName),
)
@@ -27,7 +27,7 @@ func TestCliPaginateCredentialLibraries(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -43,6 +43,7 @@ func TestCliPaginateCredentialLibraries(t *testing.T) {
// Configure vault
boundaryPolicyName := vault.SetupForBoundaryController(t, "testdata/boundary-controller-policy.hcl")
t.Cleanup(func() {
ctx := context.Background()
output := e2e.RunCommand(ctx, "vault",
e2e.WithArgs("policy", "delete", boundaryPolicyName),
)
@@ -54,6 +55,7 @@ func TestCliPaginateCredentialLibraries(t *testing.T) {
)
require.NoError(t, output.Err, string(output.Stderr))
t.Cleanup(func() {
ctx := context.Background()
output := e2e.RunCommand(ctx, "vault",
e2e.WithArgs("secrets", "disable", c.VaultSecretPath),
)
@@ -63,6 +65,7 @@ func TestCliPaginateCredentialLibraries(t *testing.T) {
// Create credentials in vault
privateKeySecretName, privateKeyPolicyName := vault.CreateKvPrivateKeyCredential(t, c.VaultSecretPath, c.TargetSshUser, c.TargetSshKeyPath)
t.Cleanup(func() {
ctx := context.Background()
output := e2e.RunCommand(ctx, "vault",
e2e.WithArgs("policy", "delete", privateKeyPolicyName),
)
@@ -179,7 +182,7 @@ func TestApiPaginateCredentialLibraries(t *testing.T) {
client, err := boundary.NewApiClient()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
sClient := scopes.NewClient(client)
cClient := credentiallibraries.NewClient(client)
orgId, err := boundary.CreateOrgApi(t, ctx, client)
@@ -195,6 +198,7 @@ func TestApiPaginateCredentialLibraries(t *testing.T) {
// Configure vault
boundaryPolicyName := vault.SetupForBoundaryController(t, "testdata/boundary-controller-policy.hcl")
t.Cleanup(func() {
ctx := context.Background()
output := e2e.RunCommand(ctx, "vault",
e2e.WithArgs("policy", "delete", boundaryPolicyName),
)
@@ -206,6 +210,7 @@ func TestApiPaginateCredentialLibraries(t *testing.T) {
)
require.NoError(t, output.Err, string(output.Stderr))
t.Cleanup(func() {
ctx := context.Background()
output := e2e.RunCommand(ctx, "vault",
e2e.WithArgs("secrets", "disable", c.VaultSecretPath),
)
@@ -215,6 +220,7 @@ func TestApiPaginateCredentialLibraries(t *testing.T) {
// Create credentials in vault
privateKeySecretName, privateKeyPolicyName := vault.CreateKvPrivateKeyCredential(t, c.VaultSecretPath, c.TargetSshUser, c.TargetSshKeyPath)
t.Cleanup(func() {
ctx := context.Background()
output := e2e.RunCommand(ctx, "vault",
e2e.WithArgs("policy", "delete", privateKeyPolicyName),
)
@@ -27,7 +27,7 @@ func TestCliTcpTargetVaultGenericConnectTargetWithAuthzToken(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -55,6 +55,7 @@ func TestCliTcpTargetVaultGenericConnectTargetWithAuthzToken(t *testing.T) {
// Configure vault
boundaryPolicyName := vault.SetupForBoundaryController(t, "testdata/boundary-controller-policy.hcl")
t.Cleanup(func() {
ctx := context.Background()
output := e2e.RunCommand(ctx, "vault",
e2e.WithArgs("policy", "delete", boundaryPolicyName),
)
@@ -66,6 +67,7 @@ func TestCliTcpTargetVaultGenericConnectTargetWithAuthzToken(t *testing.T) {
)
require.NoError(t, output.Err, string(output.Stderr))
t.Cleanup(func() {
ctx := context.Background()
output := e2e.RunCommand(ctx, "vault",
e2e.WithArgs("secrets", "disable", c.VaultSecretPath),
)
@@ -75,6 +77,7 @@ func TestCliTcpTargetVaultGenericConnectTargetWithAuthzToken(t *testing.T) {
// Create credential in vault
privateKeySecretName, privateKeyPolicyName := vault.CreateKvPrivateKeyCredential(t, c.VaultSecretPath, c.TargetSshUser, c.TargetSshKeyPath)
t.Cleanup(func() {
ctx := context.Background()
output := e2e.RunCommand(ctx, "vault",
e2e.WithArgs("policy", "delete", privateKeyPolicyName),
)
@@ -27,7 +27,7 @@ func TestCliTcpTargetVaultGenericConnectTargetWithSsh(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -55,6 +55,7 @@ func TestCliTcpTargetVaultGenericConnectTargetWithSsh(t *testing.T) {
// Configure vault
boundaryPolicyName := vault.SetupForBoundaryController(t, "testdata/boundary-controller-policy.hcl")
t.Cleanup(func() {
ctx := context.Background()
output := e2e.RunCommand(ctx, "vault",
e2e.WithArgs("policy", "delete", boundaryPolicyName),
)
@@ -66,6 +67,7 @@ func TestCliTcpTargetVaultGenericConnectTargetWithSsh(t *testing.T) {
)
require.NoError(t, output.Err, string(output.Stderr))
t.Cleanup(func() {
ctx := context.Background()
output := e2e.RunCommand(ctx, "vault",
e2e.WithArgs("secrets", "disable", c.VaultSecretPath),
)
@@ -75,6 +77,7 @@ func TestCliTcpTargetVaultGenericConnectTargetWithSsh(t *testing.T) {
// Create credential in vault
privateKeySecretName, privateKeyPolicyName := vault.CreateKvPrivateKeyCredential(t, c.VaultSecretPath, c.TargetSshUser, c.TargetSshKeyPath)
t.Cleanup(func() {
ctx := context.Background()
output := e2e.RunCommand(ctx, "vault",
e2e.WithArgs("policy", "delete", privateKeyPolicyName),
)
@@ -28,7 +28,7 @@ func TestCliTcpTargetVaultGenericConnectTarget(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -56,6 +56,7 @@ func TestCliTcpTargetVaultGenericConnectTarget(t *testing.T) {
// Configure vault
boundaryPolicyName := vault.SetupForBoundaryController(t, "testdata/boundary-controller-policy.hcl")
t.Cleanup(func() {
ctx := context.Background()
output := e2e.RunCommand(ctx, "vault",
e2e.WithArgs("policy", "delete", boundaryPolicyName),
)
@@ -67,6 +68,7 @@ func TestCliTcpTargetVaultGenericConnectTarget(t *testing.T) {
)
require.NoError(t, output.Err, string(output.Stderr))
t.Cleanup(func() {
ctx := context.Background()
output := e2e.RunCommand(ctx, "vault",
e2e.WithArgs("secrets", "disable", c.VaultSecretPath),
)
@@ -76,6 +78,7 @@ func TestCliTcpTargetVaultGenericConnectTarget(t *testing.T) {
// Create credential in vault
privateKeySecretName, privateKeyPolicyName := vault.CreateKvPrivateKeyCredential(t, c.VaultSecretPath, c.TargetSshUser, c.TargetSshKeyPath)
t.Cleanup(func() {
ctx := context.Background()
output := e2e.RunCommand(ctx, "vault",
e2e.WithArgs("policy", "delete", privateKeyPolicyName),
)
@@ -35,7 +35,7 @@ func TestCliTcpTargetWorkerConnectTarget(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -51,6 +51,7 @@ func TestCliTcpTargetWorkerConnectTarget(t *testing.T) {
// Configure vault
boundaryPolicyName := vault.SetupForBoundaryController(t, "testdata/boundary-controller-policy.hcl")
t.Cleanup(func() {
ctx := context.Background()
output := e2e.RunCommand(ctx, "vault",
e2e.WithArgs("policy", "delete", boundaryPolicyName),
)
@@ -62,6 +63,7 @@ func TestCliTcpTargetWorkerConnectTarget(t *testing.T) {
)
require.NoError(t, output.Err, string(output.Stderr))
t.Cleanup(func() {
ctx := context.Background()
output := e2e.RunCommand(ctx, "vault",
e2e.WithArgs("secrets", "disable", c.VaultSecretPath),
)
@@ -71,6 +73,7 @@ func TestCliTcpTargetWorkerConnectTarget(t *testing.T) {
// Create credential in vault
privateKeySecretName, privateKeyPolicyName := vault.CreateKvPrivateKeyCredential(t, c.VaultSecretPath, c.TargetSshUser, c.TargetSshKeyPath)
t.Cleanup(func() {
ctx := context.Background()
output := e2e.RunCommand(ctx, "vault",
e2e.WithArgs("policy", "delete", privateKeyPolicyName),
)
@@ -221,6 +224,7 @@ func TestCliTcpTargetWorkerConnectTarget(t *testing.T) {
)
require.NoError(t, output.Err, string(output.Stderr))
t.Cleanup(func() {
ctx := context.Background()
_ = e2e.RunCommand(ctx, "boundary",
e2e.WithArgs(
"workers", "remove-worker-tags",
@@ -276,6 +280,7 @@ func TestCliTcpTargetWorkerConnectTarget(t *testing.T) {
)
require.NoError(t, output.Err, string(output.Stderr))
t.Cleanup(func() {
ctx := context.Background()
_ = e2e.RunCommand(ctx, "boundary",
e2e.WithArgs(
"workers", "remove-worker-tags",
@@ -373,6 +378,7 @@ func TestCliTcpTargetWorkerConnectTarget(t *testing.T) {
)
require.NoError(t, output.Err, string(output.Stderr))
t.Cleanup(func() {
ctx := context.Background()
_ = e2e.RunCommand(ctx, "boundary",
e2e.WithArgs(
"workers", "remove-worker-tags",
@@ -45,7 +45,7 @@ func TestDatabaseMigration(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundaryRepo := "hashicorp/boundary"
boundaryTag := "latest"
@@ -291,6 +291,7 @@ func populateBoundaryDatabase(t testing.TB, ctx context.Context, c *config, te T
privateKeySecretName, privateKeyPolicyName := vault.CreateKvPrivateKeyCredential(t, c.VaultSecretPath, c.TargetSshUser, c.TargetSshKeyPath)
t.Cleanup(func() {
ctx := context.Background()
output := e2e.RunCommand(ctx, "vault",
e2e.WithArgs("policy", "delete", privateKeyPolicyName),
)
@@ -299,6 +300,7 @@ func populateBoundaryDatabase(t testing.TB, ctx context.Context, c *config, te T
passwordSecretName, passwordPolicyName, _ := vault.CreateKvPasswordCredential(t, c.VaultSecretPath, c.TargetSshUser)
t.Cleanup(func() {
ctx := context.Background()
output := e2e.RunCommand(ctx, "vault",
e2e.WithArgs("policy", "delete", passwordPolicyName),
)
@@ -27,7 +27,7 @@ func TestCliCreateGcpDynamicHostCatalogWithEmptyHostSet(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -32,7 +32,7 @@ func TestCliCreateGcpDynamicHostCatalogWithHostSet(t *testing.T) {
c, err := loadTestConfig()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
boundary.AuthenticateAdminCli(t, ctx)
orgId, err := boundary.CreateOrgCli(t, ctx)
require.NoError(t, err)
@@ -178,11 +178,12 @@ func TestApiCreateGCPDynamicHostCatalog(t *testing.T) {
client, err := boundary.NewApiClient()
require.NoError(t, err)
ctx := context.Background()
ctx := t.Context()
orgId, err := boundary.CreateOrgApi(t, ctx, client)
require.NoError(t, err)
t.Cleanup(func() {
ctx := context.Background()
scopeClient := scopes.NewClient(client)
_, err := scopeClient.Delete(ctx, orgId)
require.NoError(t, err)