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

@@ -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))