refact(e2e): Add context as an argument for cli methods
This was done have some alignment with the corresponding api methods as well as matching standard Go conventions.
This commit is contained in:
1 parent
a956e8dec9
commit
57ffc71849
15 files changed
+107
-110
No files matched your search
@@ -39,11 +39,10 @@ func CreateNewAccountApi(t testing.TB, ctx context.Context, client *api.Client,
|
|||||||
|
|
||||||
// CreateNewAccountCli creates a new account using the cli.
|
// CreateNewAccountCli creates a new account using the cli.
|
||||||
// Returns the id of the new account as well as the password that was generated
|
// Returns the id of the new account as well as the password that was generated
|
||||||
func CreateNewAccountCli(t testing.TB, loginName string) (string, string) {
|
func CreateNewAccountCli(t testing.TB, ctx context.Context, loginName string) (string, string) {
|
||||||
c, err := loadConfig()
|
c, err := loadConfig()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
ctx := context.Background()
|
|
||||||
password, err := base62.Random(16)
|
password, err := base62.Random(16)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
output := e2e.RunCommand(ctx, "boundary",
|
output := e2e.RunCommand(ctx, "boundary",
|
||||||
@@ -66,7 +65,7 @@ func CreateNewAccountCli(t testing.TB, loginName string) (string, string) {
|
|||||||
|
|
||||||
newAccountId := newAccountResult.Item.Id
|
newAccountId := newAccountResult.Item.Id
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
AuthenticateAdminCli(t)
|
AuthenticateAdminCli(t, context.Background())
|
||||||
output := e2e.RunCommand(ctx, "boundary",
|
output := e2e.RunCommand(ctx, "boundary",
|
||||||
e2e.WithArgs("accounts", "delete", "-id", newAccountId),
|
e2e.WithArgs("accounts", "delete", "-id", newAccountId),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -60,19 +60,19 @@ func NewApiClient() (*api.Client, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AuthenticateAdminCli uses the cli to authenticate the specified Boundary instance as an admin
|
// AuthenticateAdminCli uses the cli to authenticate the specified Boundary instance as an admin
|
||||||
func AuthenticateAdminCli(t testing.TB) {
|
func AuthenticateAdminCli(t testing.TB, ctx context.Context) {
|
||||||
c, err := loadConfig()
|
c, err := loadConfig()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
AuthenticateCli(t, c.AdminLoginName, c.AdminLoginPassword)
|
AuthenticateCli(t, ctx, c.AdminLoginName, c.AdminLoginPassword)
|
||||||
}
|
}
|
||||||
|
|
||||||
// AuthenticateCli uses the cli to authenticate the specified Boundary instance
|
// AuthenticateCli uses the cli to authenticate the specified Boundary instance
|
||||||
func AuthenticateCli(t testing.TB, loginName string, password string) {
|
func AuthenticateCli(t testing.TB, ctx context.Context, loginName string, password string) {
|
||||||
c, err := loadConfig()
|
c, err := loadConfig()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
output := e2e.RunCommand(context.Background(), "boundary",
|
output := e2e.RunCommand(ctx, "boundary",
|
||||||
e2e.WithArgs(
|
e2e.WithArgs(
|
||||||
"authenticate", "password",
|
"authenticate", "password",
|
||||||
"-addr", c.Address,
|
"-addr", c.Address,
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ func CreateNewCredentialStoreStaticApi(t testing.TB, ctx context.Context, client
|
|||||||
|
|
||||||
// CreateNewCredentialStoreStaticCli creates a new static credential store using the cli.
|
// CreateNewCredentialStoreStaticCli creates a new static credential store using the cli.
|
||||||
// Returns the id of the new credential store
|
// Returns the id of the new credential store
|
||||||
func CreateNewCredentialStoreStaticCli(t testing.TB, projectId string) string {
|
func CreateNewCredentialStoreStaticCli(t testing.TB, ctx context.Context, projectId string) string {
|
||||||
output := e2e.RunCommand(context.Background(), "boundary",
|
output := e2e.RunCommand(ctx, "boundary",
|
||||||
e2e.WithArgs(
|
e2e.WithArgs(
|
||||||
"credential-stores", "create", "static",
|
"credential-stores", "create", "static",
|
||||||
"-scope-id", projectId,
|
"-scope-id", projectId,
|
||||||
|
|||||||
@@ -61,8 +61,8 @@ func AddHostToHostSetApi(t testing.TB, ctx context.Context, client *api.Client,
|
|||||||
|
|
||||||
// CreateNewHostCatalogCli creates a new host catalog in boundary using the cli.
|
// CreateNewHostCatalogCli creates a new host catalog in boundary using the cli.
|
||||||
// Returns the id of the new host catalog.
|
// Returns the id of the new host catalog.
|
||||||
func CreateNewHostCatalogCli(t testing.TB, projectId string) string {
|
func CreateNewHostCatalogCli(t testing.TB, ctx context.Context, projectId string) string {
|
||||||
output := e2e.RunCommand(context.Background(), "boundary",
|
output := e2e.RunCommand(ctx, "boundary",
|
||||||
e2e.WithArgs(
|
e2e.WithArgs(
|
||||||
"host-catalogs", "create", "static",
|
"host-catalogs", "create", "static",
|
||||||
"-scope-id", projectId,
|
"-scope-id", projectId,
|
||||||
@@ -82,8 +82,8 @@ func CreateNewHostCatalogCli(t testing.TB, projectId string) string {
|
|||||||
|
|
||||||
// CreateNewHostSetCli creates a new host set in boundary using the cli.
|
// CreateNewHostSetCli creates a new host set in boundary using the cli.
|
||||||
// Returns the id of the new host set.
|
// Returns the id of the new host set.
|
||||||
func CreateNewHostSetCli(t testing.TB, hostCatalogId string) string {
|
func CreateNewHostSetCli(t testing.TB, ctx context.Context, hostCatalogId string) string {
|
||||||
output := e2e.RunCommand(context.Background(), "boundary",
|
output := e2e.RunCommand(ctx, "boundary",
|
||||||
e2e.WithArgs(
|
e2e.WithArgs(
|
||||||
"host-sets", "create", "static",
|
"host-sets", "create", "static",
|
||||||
"-host-catalog-id", hostCatalogId,
|
"-host-catalog-id", hostCatalogId,
|
||||||
@@ -103,8 +103,8 @@ func CreateNewHostSetCli(t testing.TB, hostCatalogId string) string {
|
|||||||
|
|
||||||
// CreateNewHostCli creates a new host in boundary using the cli.
|
// CreateNewHostCli creates a new host in boundary using the cli.
|
||||||
// Returns the id of the new host.
|
// Returns the id of the new host.
|
||||||
func CreateNewHostCli(t testing.TB, hostCatalogId string, address string) string {
|
func CreateNewHostCli(t testing.TB, ctx context.Context, hostCatalogId string, address string) string {
|
||||||
output := e2e.RunCommand(context.Background(), "boundary",
|
output := e2e.RunCommand(ctx, "boundary",
|
||||||
e2e.WithArgs(
|
e2e.WithArgs(
|
||||||
"hosts", "create", "static",
|
"hosts", "create", "static",
|
||||||
"-host-catalog-id", hostCatalogId,
|
"-host-catalog-id", hostCatalogId,
|
||||||
@@ -124,8 +124,8 @@ func CreateNewHostCli(t testing.TB, hostCatalogId string, address string) string
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AddHostToHostSetCli adds a host to a host set using the cli
|
// AddHostToHostSetCli adds a host to a host set using the cli
|
||||||
func AddHostToHostSetCli(t testing.TB, hostSetId string, hostId string) {
|
func AddHostToHostSetCli(t testing.TB, ctx context.Context, hostSetId string, hostId string) {
|
||||||
output := e2e.RunCommand(context.Background(), "boundary",
|
output := e2e.RunCommand(ctx, "boundary",
|
||||||
e2e.WithArgs("host-sets", "add-hosts", "-id", hostSetId, "-host", hostId),
|
e2e.WithArgs("host-sets", "add-hosts", "-id", hostSetId, "-host", hostId),
|
||||||
)
|
)
|
||||||
require.NoError(t, output.Err, string(output.Stderr))
|
require.NoError(t, output.Err, string(output.Stderr))
|
||||||
|
|||||||
@@ -43,8 +43,7 @@ func CreateNewProjectApi(t testing.TB, ctx context.Context, client *api.Client,
|
|||||||
|
|
||||||
// CreateNewOrgCli creates a new organization in boundary using the cli.
|
// CreateNewOrgCli creates a new organization in boundary using the cli.
|
||||||
// Returns the id of the new org.
|
// Returns the id of the new org.
|
||||||
func CreateNewOrgCli(t testing.TB) string {
|
func CreateNewOrgCli(t testing.TB, ctx context.Context) string {
|
||||||
ctx := context.Background()
|
|
||||||
output := e2e.RunCommand(ctx, "boundary",
|
output := e2e.RunCommand(ctx, "boundary",
|
||||||
e2e.WithArgs(
|
e2e.WithArgs(
|
||||||
"scopes", "create",
|
"scopes", "create",
|
||||||
@@ -61,7 +60,7 @@ func CreateNewOrgCli(t testing.TB) string {
|
|||||||
|
|
||||||
newOrgId := newOrgResult.Item.Id
|
newOrgId := newOrgResult.Item.Id
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
AuthenticateAdminCli(t)
|
AuthenticateAdminCli(t, context.Background())
|
||||||
output := e2e.RunCommand(ctx, "boundary",
|
output := e2e.RunCommand(ctx, "boundary",
|
||||||
e2e.WithArgs("scopes", "delete", "-id", newOrgId),
|
e2e.WithArgs("scopes", "delete", "-id", newOrgId),
|
||||||
)
|
)
|
||||||
@@ -75,8 +74,7 @@ func CreateNewOrgCli(t testing.TB) string {
|
|||||||
// CreateNewProjectCli creates a new project in boundary using the cli. The project will be created
|
// CreateNewProjectCli creates a new project in boundary using the cli. The project will be created
|
||||||
// under the provided org id.
|
// under the provided org id.
|
||||||
// Returns the id of the new project.
|
// Returns the id of the new project.
|
||||||
func CreateNewProjectCli(t testing.TB, orgId string) string {
|
func CreateNewProjectCli(t testing.TB, ctx context.Context, orgId string) string {
|
||||||
ctx := context.Background()
|
|
||||||
output := e2e.RunCommand(ctx, "boundary",
|
output := e2e.RunCommand(ctx, "boundary",
|
||||||
e2e.WithArgs(
|
e2e.WithArgs(
|
||||||
"scopes", "create",
|
"scopes", "create",
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ func AddHostSourceToTargetApi(t testing.TB, ctx context.Context, client *api.Cli
|
|||||||
|
|
||||||
// CreateNewTargetCli creates a new target in boundary using the cli
|
// CreateNewTargetCli creates a new target in boundary using the cli
|
||||||
// Returns the id of the new target.
|
// Returns the id of the new target.
|
||||||
func CreateNewTargetCli(t testing.TB, projectId string, defaultPort string) string {
|
func CreateNewTargetCli(t testing.TB, ctx context.Context, projectId string, defaultPort string) string {
|
||||||
output := e2e.RunCommand(context.Background(), "boundary",
|
output := e2e.RunCommand(ctx, "boundary",
|
||||||
e2e.WithArgs(
|
e2e.WithArgs(
|
||||||
"targets", "create", "tcp",
|
"targets", "create", "tcp",
|
||||||
"-scope-id", projectId,
|
"-scope-id", projectId,
|
||||||
@@ -62,8 +62,8 @@ func CreateNewTargetCli(t testing.TB, projectId string, defaultPort string) stri
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AddHostSourceToTargetCli adds a host source (host set or host) to a target using the cli
|
// AddHostSourceToTargetCli adds a host source (host set or host) to a target using the cli
|
||||||
func AddHostSourceToTargetCli(t testing.TB, targetId string, hostSourceId string) {
|
func AddHostSourceToTargetCli(t testing.TB, ctx context.Context, targetId string, hostSourceId string) {
|
||||||
output := e2e.RunCommand(context.Background(), "boundary",
|
output := e2e.RunCommand(ctx, "boundary",
|
||||||
e2e.WithArgs("targets", "add-host-sources", "-id", targetId, "-host-source", hostSourceId),
|
e2e.WithArgs("targets", "add-host-sources", "-id", targetId, "-host-source", hostSourceId),
|
||||||
)
|
)
|
||||||
require.NoError(t, output.Err, string(output.Stderr))
|
require.NoError(t, output.Err, string(output.Stderr))
|
||||||
|
|||||||
@@ -29,8 +29,7 @@ func CreateNewUserApi(t testing.TB, ctx context.Context, client *api.Client, sco
|
|||||||
|
|
||||||
// CreateNewUserCli creates a new user using the cli.
|
// CreateNewUserCli creates a new user using the cli.
|
||||||
// Returns the id of the new user
|
// Returns the id of the new user
|
||||||
func CreateNewUserCli(t testing.TB, scopeId string) string {
|
func CreateNewUserCli(t testing.TB, ctx context.Context, scopeId string) string {
|
||||||
ctx := context.Background()
|
|
||||||
output := e2e.RunCommand(ctx, "boundary",
|
output := e2e.RunCommand(ctx, "boundary",
|
||||||
e2e.WithArgs(
|
e2e.WithArgs(
|
||||||
"users", "create",
|
"users", "create",
|
||||||
@@ -48,7 +47,7 @@ func CreateNewUserCli(t testing.TB, scopeId string) string {
|
|||||||
|
|
||||||
newUserId := newUserResult.Item.Id
|
newUserId := newUserResult.Item.Id
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
AuthenticateAdminCli(t)
|
AuthenticateAdminCli(t, context.Background())
|
||||||
output := e2e.RunCommand(ctx, "boundary",
|
output := e2e.RunCommand(ctx, "boundary",
|
||||||
e2e.WithArgs("users", "delete", "-id", newUserId),
|
e2e.WithArgs("users", "delete", "-id", newUserId),
|
||||||
)
|
)
|
||||||
@@ -60,8 +59,8 @@ func CreateNewUserCli(t testing.TB, scopeId string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SetAccountToUserCli sets an account to a the specified user using the cli.
|
// SetAccountToUserCli sets an account to a the specified user using the cli.
|
||||||
func SetAccountToUserCli(t testing.TB, userId string, accountId string) {
|
func SetAccountToUserCli(t testing.TB, ctx context.Context, userId string, accountId string) {
|
||||||
output := e2e.RunCommand(context.Background(), "boundary",
|
output := e2e.RunCommand(ctx, "boundary",
|
||||||
e2e.WithArgs(
|
e2e.WithArgs(
|
||||||
"users", "set-accounts",
|
"users", "set-accounts",
|
||||||
"-id", userId,
|
"-id", userId,
|
||||||
|
|||||||
@@ -52,18 +52,19 @@ func TestCreateVaultCredentialStoreCli(t *testing.T) {
|
|||||||
c, err := loadConfig()
|
c, err := loadConfig()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
boundary.AuthenticateAdminCli(t)
|
ctx := context.Background()
|
||||||
newOrgId := boundary.CreateNewOrgCli(t)
|
boundary.AuthenticateAdminCli(t, ctx)
|
||||||
newProjectId := boundary.CreateNewProjectCli(t, newOrgId)
|
newOrgId := boundary.CreateNewOrgCli(t, ctx)
|
||||||
newHostCatalogId := boundary.CreateNewHostCatalogCli(t, newProjectId)
|
newProjectId := boundary.CreateNewProjectCli(t, ctx, newOrgId)
|
||||||
newHostSetId := boundary.CreateNewHostSetCli(t, newHostCatalogId)
|
newHostCatalogId := boundary.CreateNewHostCatalogCli(t, ctx, newProjectId)
|
||||||
newHostId := boundary.CreateNewHostCli(t, newHostCatalogId, c.TargetIp)
|
newHostSetId := boundary.CreateNewHostSetCli(t, ctx, newHostCatalogId)
|
||||||
boundary.AddHostToHostSetCli(t, newHostSetId, newHostId)
|
newHostId := boundary.CreateNewHostCli(t, ctx, newHostCatalogId, c.TargetIp)
|
||||||
newTargetId := boundary.CreateNewTargetCli(t, newProjectId, c.TargetPort)
|
boundary.AddHostToHostSetCli(t, ctx, newHostSetId, newHostId)
|
||||||
boundary.AddHostSourceToTargetCli(t, newTargetId, newHostSetId)
|
newTargetId := boundary.CreateNewTargetCli(t, ctx, newProjectId, c.TargetPort)
|
||||||
|
boundary.AddHostSourceToTargetCli(t, ctx, newTargetId, newHostSetId)
|
||||||
|
|
||||||
// Configure vault
|
// Configure vault
|
||||||
ctx := context.Background()
|
|
||||||
vaultAddr, boundaryPolicyName := vault.Setup(t)
|
vaultAddr, boundaryPolicyName := vault.Setup(t)
|
||||||
|
|
||||||
output := e2e.RunCommand(ctx, "vault",
|
output := e2e.RunCommand(ctx, "vault",
|
||||||
|
|||||||
@@ -50,12 +50,12 @@ func TestCreateAwsDynamicHostCatalogCli(t *testing.T) {
|
|||||||
c, err := loadConfig()
|
c, err := loadConfig()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
boundary.AuthenticateAdminCli(t)
|
ctx := context.Background()
|
||||||
newOrgId := boundary.CreateNewOrgCli(t)
|
boundary.AuthenticateAdminCli(t, ctx)
|
||||||
newProjectId := boundary.CreateNewProjectCli(t, newOrgId)
|
newOrgId := boundary.CreateNewOrgCli(t, ctx)
|
||||||
|
newProjectId := boundary.CreateNewProjectCli(t, ctx, newOrgId)
|
||||||
|
|
||||||
// Create a dynamic host catalog
|
// Create a dynamic host catalog
|
||||||
ctx := context.Background()
|
|
||||||
output := e2e.RunCommand(ctx, "boundary",
|
output := e2e.RunCommand(ctx, "boundary",
|
||||||
e2e.WithArgs(
|
e2e.WithArgs(
|
||||||
"host-catalogs", "create", "plugin",
|
"host-catalogs", "create", "plugin",
|
||||||
@@ -228,8 +228,8 @@ func TestCreateAwsDynamicHostCatalogCli(t *testing.T) {
|
|||||||
assert.Equal(t, expectedHostCatalogCount, actualHostCatalogCount, "Numbers of hosts in host catalog did not match expected amount")
|
assert.Equal(t, expectedHostCatalogCount, actualHostCatalogCount, "Numbers of hosts in host catalog did not match expected amount")
|
||||||
|
|
||||||
// Create target
|
// Create target
|
||||||
newTargetId := boundary.CreateNewTargetCli(t, newProjectId, c.TargetPort)
|
newTargetId := boundary.CreateNewTargetCli(t, ctx, newProjectId, c.TargetPort)
|
||||||
boundary.AddHostSourceToTargetCli(t, newTargetId, newHostSetId1)
|
boundary.AddHostSourceToTargetCli(t, ctx, newTargetId, newHostSetId1)
|
||||||
|
|
||||||
// Connect to target
|
// Connect to target
|
||||||
output = e2e.RunCommand(ctx, "boundary",
|
output = e2e.RunCommand(ctx, "boundary",
|
||||||
|
|||||||
@@ -23,19 +23,19 @@ func TestConnectTargetWithAuthzTokenCli(t *testing.T) {
|
|||||||
c, err := loadConfig()
|
c, err := loadConfig()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
boundary.AuthenticateAdminCli(t)
|
ctx := context.Background()
|
||||||
newOrgId := boundary.CreateNewOrgCli(t)
|
boundary.AuthenticateAdminCli(t, ctx)
|
||||||
newProjectId := boundary.CreateNewProjectCli(t, newOrgId)
|
newOrgId := boundary.CreateNewOrgCli(t, ctx)
|
||||||
newHostCatalogId := boundary.CreateNewHostCatalogCli(t, newProjectId)
|
newProjectId := boundary.CreateNewProjectCli(t, ctx, newOrgId)
|
||||||
newHostSetId := boundary.CreateNewHostSetCli(t, newHostCatalogId)
|
newHostCatalogId := boundary.CreateNewHostCatalogCli(t, ctx, newProjectId)
|
||||||
newHostId := boundary.CreateNewHostCli(t, newHostCatalogId, c.TargetIp)
|
newHostSetId := boundary.CreateNewHostSetCli(t, ctx, newHostCatalogId)
|
||||||
boundary.AddHostToHostSetCli(t, newHostSetId, newHostId)
|
newHostId := boundary.CreateNewHostCli(t, ctx, newHostCatalogId, c.TargetIp)
|
||||||
newTargetId := boundary.CreateNewTargetCli(t, newProjectId, c.TargetPort)
|
boundary.AddHostToHostSetCli(t, ctx, newHostSetId, newHostId)
|
||||||
boundary.AddHostSourceToTargetCli(t, newTargetId, newHostSetId)
|
newTargetId := boundary.CreateNewTargetCli(t, ctx, newProjectId, c.TargetPort)
|
||||||
newCredentialStoreId := boundary.CreateNewCredentialStoreStaticCli(t, newProjectId)
|
boundary.AddHostSourceToTargetCli(t, ctx, newTargetId, newHostSetId)
|
||||||
|
newCredentialStoreId := boundary.CreateNewCredentialStoreStaticCli(t, ctx, newProjectId)
|
||||||
|
|
||||||
// Create credentials
|
// Create credentials
|
||||||
ctx := context.Background()
|
|
||||||
output := e2e.RunCommand(ctx, "boundary",
|
output := e2e.RunCommand(ctx, "boundary",
|
||||||
e2e.WithArgs(
|
e2e.WithArgs(
|
||||||
"credentials", "create", "ssh-private-key",
|
"credentials", "create", "ssh-private-key",
|
||||||
|
|||||||
@@ -23,19 +23,19 @@ func TestConnectTargetWithSshCli(t *testing.T) {
|
|||||||
c, err := loadConfig()
|
c, err := loadConfig()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
boundary.AuthenticateAdminCli(t)
|
ctx := context.Background()
|
||||||
newOrgId := boundary.CreateNewOrgCli(t)
|
boundary.AuthenticateAdminCli(t, ctx)
|
||||||
newProjectId := boundary.CreateNewProjectCli(t, newOrgId)
|
newOrgId := boundary.CreateNewOrgCli(t, ctx)
|
||||||
newHostCatalogId := boundary.CreateNewHostCatalogCli(t, newProjectId)
|
newProjectId := boundary.CreateNewProjectCli(t, ctx, newOrgId)
|
||||||
newHostSetId := boundary.CreateNewHostSetCli(t, newHostCatalogId)
|
newHostCatalogId := boundary.CreateNewHostCatalogCli(t, ctx, newProjectId)
|
||||||
newHostId := boundary.CreateNewHostCli(t, newHostCatalogId, c.TargetIp)
|
newHostSetId := boundary.CreateNewHostSetCli(t, ctx, newHostCatalogId)
|
||||||
boundary.AddHostToHostSetCli(t, newHostSetId, newHostId)
|
newHostId := boundary.CreateNewHostCli(t, ctx, newHostCatalogId, c.TargetIp)
|
||||||
newTargetId := boundary.CreateNewTargetCli(t, newProjectId, c.TargetPort)
|
boundary.AddHostToHostSetCli(t, ctx, newHostSetId, newHostId)
|
||||||
boundary.AddHostSourceToTargetCli(t, newTargetId, newHostSetId)
|
newTargetId := boundary.CreateNewTargetCli(t, ctx, newProjectId, c.TargetPort)
|
||||||
newCredentialStoreId := boundary.CreateNewCredentialStoreStaticCli(t, newProjectId)
|
boundary.AddHostSourceToTargetCli(t, ctx, newTargetId, newHostSetId)
|
||||||
|
newCredentialStoreId := boundary.CreateNewCredentialStoreStaticCli(t, ctx, newProjectId)
|
||||||
|
|
||||||
// Create credentials
|
// Create credentials
|
||||||
ctx := context.Background()
|
|
||||||
output := e2e.RunCommand(ctx, "boundary",
|
output := e2e.RunCommand(ctx, "boundary",
|
||||||
e2e.WithArgs(
|
e2e.WithArgs(
|
||||||
"credentials", "create", "ssh-private-key",
|
"credentials", "create", "ssh-private-key",
|
||||||
|
|||||||
@@ -18,18 +18,18 @@ func TestConnectTargetCli(t *testing.T) {
|
|||||||
c, err := loadConfig()
|
c, err := loadConfig()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
boundary.AuthenticateAdminCli(t)
|
ctx := context.Background()
|
||||||
newOrgId := boundary.CreateNewOrgCli(t)
|
boundary.AuthenticateAdminCli(t, ctx)
|
||||||
newProjectId := boundary.CreateNewProjectCli(t, newOrgId)
|
newOrgId := boundary.CreateNewOrgCli(t, ctx)
|
||||||
newHostCatalogId := boundary.CreateNewHostCatalogCli(t, newProjectId)
|
newProjectId := boundary.CreateNewProjectCli(t, ctx, newOrgId)
|
||||||
newHostSetId := boundary.CreateNewHostSetCli(t, newHostCatalogId)
|
newHostCatalogId := boundary.CreateNewHostCatalogCli(t, ctx, newProjectId)
|
||||||
newHostId := boundary.CreateNewHostCli(t, newHostCatalogId, c.TargetIp)
|
newHostSetId := boundary.CreateNewHostSetCli(t, ctx, newHostCatalogId)
|
||||||
boundary.AddHostToHostSetCli(t, newHostSetId, newHostId)
|
newHostId := boundary.CreateNewHostCli(t, ctx, newHostCatalogId, c.TargetIp)
|
||||||
newTargetId := boundary.CreateNewTargetCli(t, newProjectId, c.TargetPort)
|
boundary.AddHostToHostSetCli(t, ctx, newHostSetId, newHostId)
|
||||||
boundary.AddHostSourceToTargetCli(t, newTargetId, newHostSetId)
|
newTargetId := boundary.CreateNewTargetCli(t, ctx, newProjectId, c.TargetPort)
|
||||||
|
boundary.AddHostSourceToTargetCli(t, ctx, newTargetId, newHostSetId)
|
||||||
|
|
||||||
// Connect to target and print host's IP address
|
// Connect to target and print host's IP address
|
||||||
ctx := context.Background()
|
|
||||||
output := e2e.RunCommand(ctx, "boundary",
|
output := e2e.RunCommand(ctx, "boundary",
|
||||||
e2e.WithArgs(
|
e2e.WithArgs(
|
||||||
"connect",
|
"connect",
|
||||||
|
|||||||
@@ -21,15 +21,16 @@ func TestSessionCancelAdminCli(t *testing.T) {
|
|||||||
c, err := loadConfig()
|
c, err := loadConfig()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
boundary.AuthenticateAdminCli(t)
|
ctx := context.Background()
|
||||||
newOrgId := boundary.CreateNewOrgCli(t)
|
boundary.AuthenticateAdminCli(t, ctx)
|
||||||
newProjectId := boundary.CreateNewProjectCli(t, newOrgId)
|
newOrgId := boundary.CreateNewOrgCli(t, ctx)
|
||||||
newHostCatalogId := boundary.CreateNewHostCatalogCli(t, newProjectId)
|
newProjectId := boundary.CreateNewProjectCli(t, ctx, newOrgId)
|
||||||
newHostSetId := boundary.CreateNewHostSetCli(t, newHostCatalogId)
|
newHostCatalogId := boundary.CreateNewHostCatalogCli(t, ctx, newProjectId)
|
||||||
newHostId := boundary.CreateNewHostCli(t, newHostCatalogId, c.TargetIp)
|
newHostSetId := boundary.CreateNewHostSetCli(t, ctx, newHostCatalogId)
|
||||||
boundary.AddHostToHostSetCli(t, newHostSetId, newHostId)
|
newHostId := boundary.CreateNewHostCli(t, ctx, newHostCatalogId, c.TargetIp)
|
||||||
newTargetId := boundary.CreateNewTargetCli(t, newProjectId, c.TargetPort)
|
boundary.AddHostToHostSetCli(t, ctx, newHostSetId, newHostId)
|
||||||
boundary.AddHostSourceToTargetCli(t, newTargetId, newHostSetId)
|
newTargetId := boundary.CreateNewTargetCli(t, ctx, newProjectId, c.TargetPort)
|
||||||
|
boundary.AddHostSourceToTargetCli(t, ctx, newTargetId, newHostSetId)
|
||||||
|
|
||||||
// Connect to target to create a session
|
// Connect to target to create a session
|
||||||
ctxCancel, cancel := context.WithCancel(context.Background())
|
ctxCancel, cancel := context.WithCancel(context.Background())
|
||||||
@@ -55,7 +56,6 @@ func TestSessionCancelAdminCli(t *testing.T) {
|
|||||||
t.Cleanup(cancel)
|
t.Cleanup(cancel)
|
||||||
|
|
||||||
// Get list of sessions
|
// Get list of sessions
|
||||||
ctx := context.Background()
|
|
||||||
var session *sessions.Session
|
var session *sessions.Session
|
||||||
err = backoff.RetryNotify(
|
err = backoff.RetryNotify(
|
||||||
func() error {
|
func() error {
|
||||||
|
|||||||
@@ -25,23 +25,23 @@ func TestSessionCancelUserCli(t *testing.T) {
|
|||||||
c, err := loadConfig()
|
c, err := loadConfig()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
boundary.AuthenticateAdminCli(t)
|
ctx := context.Background()
|
||||||
newOrgId := boundary.CreateNewOrgCli(t)
|
boundary.AuthenticateAdminCli(t, ctx)
|
||||||
newProjectId := boundary.CreateNewProjectCli(t, newOrgId)
|
newOrgId := boundary.CreateNewOrgCli(t, ctx)
|
||||||
newHostCatalogId := boundary.CreateNewHostCatalogCli(t, newProjectId)
|
newProjectId := boundary.CreateNewProjectCli(t, ctx, newOrgId)
|
||||||
newHostSetId := boundary.CreateNewHostSetCli(t, newHostCatalogId)
|
newHostCatalogId := boundary.CreateNewHostCatalogCli(t, ctx, newProjectId)
|
||||||
newHostId := boundary.CreateNewHostCli(t, newHostCatalogId, c.TargetIp)
|
newHostSetId := boundary.CreateNewHostSetCli(t, ctx, newHostCatalogId)
|
||||||
boundary.AddHostToHostSetCli(t, newHostSetId, newHostId)
|
newHostId := boundary.CreateNewHostCli(t, ctx, newHostCatalogId, c.TargetIp)
|
||||||
newTargetId := boundary.CreateNewTargetCli(t, newProjectId, c.TargetPort)
|
boundary.AddHostToHostSetCli(t, ctx, newHostSetId, newHostId)
|
||||||
boundary.AddHostSourceToTargetCli(t, newTargetId, newHostSetId)
|
newTargetId := boundary.CreateNewTargetCli(t, ctx, newProjectId, c.TargetPort)
|
||||||
|
boundary.AddHostSourceToTargetCli(t, ctx, newTargetId, newHostSetId)
|
||||||
acctName := "e2e-account"
|
acctName := "e2e-account"
|
||||||
newAccountId, acctPassword := boundary.CreateNewAccountCli(t, acctName)
|
newAccountId, acctPassword := boundary.CreateNewAccountCli(t, ctx, acctName)
|
||||||
newUserId := boundary.CreateNewUserCli(t, "global")
|
newUserId := boundary.CreateNewUserCli(t, ctx, "global")
|
||||||
boundary.SetAccountToUserCli(t, newUserId, newAccountId)
|
boundary.SetAccountToUserCli(t, ctx, newUserId, newAccountId)
|
||||||
|
|
||||||
// Try to connect to the target as a user without permissions
|
// Try to connect to the target as a user without permissions
|
||||||
ctx := context.Background()
|
boundary.AuthenticateCli(t, ctx, acctName, acctPassword)
|
||||||
boundary.AuthenticateCli(t, acctName, acctPassword)
|
|
||||||
output := e2e.RunCommand(ctx, "boundary",
|
output := e2e.RunCommand(ctx, "boundary",
|
||||||
e2e.WithArgs(
|
e2e.WithArgs(
|
||||||
"connect",
|
"connect",
|
||||||
@@ -66,7 +66,7 @@ func TestSessionCancelUserCli(t *testing.T) {
|
|||||||
t.Log("Successfully received an error when connecting to target as a user without permissions")
|
t.Log("Successfully received an error when connecting to target as a user without permissions")
|
||||||
|
|
||||||
// Create a role
|
// Create a role
|
||||||
boundary.AuthenticateAdminCli(t)
|
boundary.AuthenticateAdminCli(t, ctx)
|
||||||
output = e2e.RunCommand(ctx, "boundary",
|
output = e2e.RunCommand(ctx, "boundary",
|
||||||
e2e.WithArgs(
|
e2e.WithArgs(
|
||||||
"roles", "create",
|
"roles", "create",
|
||||||
@@ -106,7 +106,7 @@ func TestSessionCancelUserCli(t *testing.T) {
|
|||||||
ctxCancel, cancel := context.WithCancel(context.Background())
|
ctxCancel, cancel := context.WithCancel(context.Background())
|
||||||
errChan := make(chan *e2e.CommandResult)
|
errChan := make(chan *e2e.CommandResult)
|
||||||
go func() {
|
go func() {
|
||||||
boundary.AuthenticateCli(t, acctName, acctPassword)
|
boundary.AuthenticateCli(t, ctx, acctName, acctPassword)
|
||||||
t.Log("Starting session as user...")
|
t.Log("Starting session as user...")
|
||||||
errChan <- e2e.RunCommand(ctxCancel, "boundary",
|
errChan <- e2e.RunCommand(ctxCancel, "boundary",
|
||||||
e2e.WithArgs(
|
e2e.WithArgs(
|
||||||
|
|||||||
@@ -20,13 +20,13 @@ func TestStaticCredentialStoreCli(t *testing.T) {
|
|||||||
c, err := loadConfig()
|
c, err := loadConfig()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
boundary.AuthenticateAdminCli(t)
|
ctx := context.Background()
|
||||||
newOrgId := boundary.CreateNewOrgCli(t)
|
boundary.AuthenticateAdminCli(t, ctx)
|
||||||
newProjectId := boundary.CreateNewProjectCli(t, newOrgId)
|
newOrgId := boundary.CreateNewOrgCli(t, ctx)
|
||||||
newCredentialStoreId := boundary.CreateNewCredentialStoreStaticCli(t, newProjectId)
|
newProjectId := boundary.CreateNewProjectCli(t, ctx, newOrgId)
|
||||||
|
newCredentialStoreId := boundary.CreateNewCredentialStoreStaticCli(t, ctx, newProjectId)
|
||||||
|
|
||||||
// Create ssh key credentials
|
// Create ssh key credentials
|
||||||
ctx := context.Background()
|
|
||||||
output := e2e.RunCommand(ctx, "boundary",
|
output := e2e.RunCommand(ctx, "boundary",
|
||||||
e2e.WithArgs(
|
e2e.WithArgs(
|
||||||
"credentials", "create", "ssh-private-key",
|
"credentials", "create", "ssh-private-key",
|
||||||
|
|||||||
Reference in new issue
Block a user