refact(e2e): Rename some test files and methods (#3360)
* refact: Rename method for clarity * refact: Rename test files for clarity * test(e2e): Add method for removing brokered credential
This commit is contained in:
1 parent
a751d65831
commit
42ab20b37b
12 files changed
+30
-17
No files matched your search
@@ -129,9 +129,9 @@ func RemoveHostSourceFromTargetCli(t testing.TB, ctx context.Context, targetId,
|
||||
require.NoError(t, output.Err, string(output.Stderr))
|
||||
}
|
||||
|
||||
// AddCredentialSourceToTargetCli uses the cli to add a credential source (credential library or
|
||||
// AddBrokeredCredentialSourceToTargetCli uses the cli to add a credential source (credential library or
|
||||
// credential) to a target
|
||||
func AddCredentialSourceToTargetCli(t testing.TB, ctx context.Context, targetId string, credentialSourceId string) {
|
||||
func AddBrokeredCredentialSourceToTargetCli(t testing.TB, ctx context.Context, targetId string, credentialSourceId string) {
|
||||
output := e2e.RunCommand(ctx, "boundary",
|
||||
e2e.WithArgs(
|
||||
"targets", "add-credential-sources",
|
||||
@@ -141,3 +141,16 @@ func AddCredentialSourceToTargetCli(t testing.TB, ctx context.Context, targetId
|
||||
)
|
||||
require.NoError(t, output.Err, string(output.Stderr))
|
||||
}
|
||||
|
||||
// RemoveBrokeredCredentialSourceFromTargetCli uses the cli to remove a credential source (credential library or
|
||||
// credential) from a target
|
||||
func RemoveBrokeredCredentialSourceFromTargetCli(t testing.TB, ctx context.Context, targetId string, credentialSourceId string) {
|
||||
output := e2e.RunCommand(ctx, "boundary",
|
||||
e2e.WithArgs(
|
||||
"targets", "remove-credential-sources",
|
||||
"-id", targetId,
|
||||
"-brokered-credential-source", credentialSourceId,
|
||||
),
|
||||
)
|
||||
require.NoError(t, output.Err, string(output.Stderr))
|
||||
}
|
||||
@@ -79,9 +79,9 @@ func TestCliStaticCredentialStore(t *testing.T) {
|
||||
require.True(t, newSessionAuthorizationResult.Item.Credentials == nil)
|
||||
|
||||
// Add credentials to target
|
||||
boundary.AddCredentialSourceToTargetCli(t, ctx, newTargetId, privateKeyCredentialsId)
|
||||
boundary.AddCredentialSourceToTargetCli(t, ctx, newTargetId, jsonCredentialsId)
|
||||
boundary.AddCredentialSourceToTargetCli(t, ctx, newTargetId, pwCredentialsId)
|
||||
boundary.AddBrokeredCredentialSourceToTargetCli(t, ctx, newTargetId, privateKeyCredentialsId)
|
||||
boundary.AddBrokeredCredentialSourceToTargetCli(t, ctx, newTargetId, jsonCredentialsId)
|
||||
boundary.AddBrokeredCredentialSourceToTargetCli(t, ctx, newTargetId, pwCredentialsId)
|
||||
|
||||
// Get credentials for target
|
||||
output = e2e.RunCommand(ctx, "boundary",
|
||||
|
||||
File renamed without changes.
+2
-2
@@ -20,7 +20,7 @@ import (
|
||||
|
||||
// TestCliConnectTargetWithAuthzToken uses the boundary cli to connect to a target using the
|
||||
// `authz_token` option
|
||||
func TestCliConnectTargetWithAuthzToken(t *testing.T) {
|
||||
func TestCliTcpTargetConnectTargetWithAuthzToken(t *testing.T) {
|
||||
e2e.MaybeSkipTest(t)
|
||||
c, err := loadTestConfig()
|
||||
require.NoError(t, err)
|
||||
@@ -43,7 +43,7 @@ func TestCliConnectTargetWithAuthzToken(t *testing.T) {
|
||||
boundary.AddHostSourceToTargetCli(t, ctx, newTargetId, newHostSetId)
|
||||
newCredentialStoreId := boundary.CreateNewCredentialStoreStaticCli(t, ctx, newProjectId)
|
||||
newCredentialsId := boundary.CreateNewStaticCredentialPrivateKeyCli(t, ctx, newCredentialStoreId, c.TargetSshUser, c.TargetSshKeyPath)
|
||||
boundary.AddCredentialSourceToTargetCli(t, ctx, newTargetId, newCredentialsId)
|
||||
boundary.AddBrokeredCredentialSourceToTargetCli(t, ctx, newTargetId, newCredentialsId)
|
||||
|
||||
// Get credentials for target
|
||||
output := e2e.RunCommand(ctx, "boundary",
|
||||
+1
-1
@@ -16,7 +16,7 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestCliConnectTargetWithLocalhost(t *testing.T) {
|
||||
func TestCliTcpTargetConnectTargetWithLocalhost(t *testing.T) {
|
||||
e2e.MaybeSkipTest(t)
|
||||
c, err := loadTestConfig()
|
||||
require.NoError(t, err)
|
||||
+1
-1
@@ -42,7 +42,7 @@ func TestCliConnectTargetWithSsh(t *testing.T) {
|
||||
boundary.AddHostSourceToTargetCli(t, ctx, newTargetId, newHostSetId)
|
||||
newCredentialStoreId := boundary.CreateNewCredentialStoreStaticCli(t, ctx, newProjectId)
|
||||
newCredentialsId := boundary.CreateNewStaticCredentialPrivateKeyCli(t, ctx, newCredentialStoreId, c.TargetSshUser, c.TargetSshKeyPath)
|
||||
boundary.AddCredentialSourceToTargetCli(t, ctx, newTargetId, newCredentialsId)
|
||||
boundary.AddBrokeredCredentialSourceToTargetCli(t, ctx, newTargetId, newCredentialsId)
|
||||
|
||||
// Get credentials for target
|
||||
output := e2e.RunCommand(ctx, "boundary",
|
||||
+2
-2
@@ -19,7 +19,7 @@ import (
|
||||
// TestCliConnectTargetBasic uses the boundary cli to create a number of
|
||||
// supporting objects to connect to a target. It then attempts to connect to
|
||||
// that target and verifies that the connection was successful.
|
||||
func TestCliConnectTargetBasic(t *testing.T) {
|
||||
func TestCliTcpTargetConnectTargetBasic(t *testing.T) {
|
||||
e2e.MaybeSkipTest(t)
|
||||
c, err := loadTestConfig()
|
||||
require.NoError(t, err)
|
||||
@@ -65,7 +65,7 @@ func TestCliConnectTargetBasic(t *testing.T) {
|
||||
t.Log("Successfully connected to target")
|
||||
}
|
||||
|
||||
func TestCliConnectTargetWithTargetClientPort(t *testing.T) {
|
||||
func TestCliTcpTargetConnectTargetWithTargetClientPort(t *testing.T) {
|
||||
e2e.MaybeSkipTest(t)
|
||||
c, err := loadTestConfig()
|
||||
require.NoError(t, err)
|
||||
@@ -117,7 +117,7 @@ func TestCliVaultConnectTargetWithAuthzToken(t *testing.T) {
|
||||
newCredentialLibraryId := newCredentialLibraryResult.Item.Id
|
||||
t.Logf("Created Credential Library: %s", newCredentialLibraryId)
|
||||
|
||||
boundary.AddCredentialSourceToTargetCli(t, ctx, newTargetId, newCredentialLibraryId)
|
||||
boundary.AddBrokeredCredentialSourceToTargetCli(t, ctx, newTargetId, newCredentialLibraryId)
|
||||
|
||||
// Get credentials for target
|
||||
output = e2e.RunCommand(ctx, "boundary",
|
||||
|
||||
@@ -117,7 +117,7 @@ func TestCliVaultConnectTargetWithSsh(t *testing.T) {
|
||||
t.Logf("Created Credential Library: %s", newCredentialLibraryId)
|
||||
|
||||
// Add brokered credentials to target
|
||||
boundary.AddCredentialSourceToTargetCli(t, ctx, newTargetId, newCredentialLibraryId)
|
||||
boundary.AddBrokeredCredentialSourceToTargetCli(t, ctx, newTargetId, newCredentialLibraryId)
|
||||
|
||||
// Get credentials for target
|
||||
output = e2e.RunCommand(ctx, "boundary",
|
||||
|
||||
@@ -119,7 +119,7 @@ func TestCliVaultConnectTarget(t *testing.T) {
|
||||
t.Logf("Created Credential Library: %s", newCredentialLibraryId)
|
||||
|
||||
// Add brokered credentials to target
|
||||
boundary.AddCredentialSourceToTargetCli(t, ctx, newTargetId, newCredentialLibraryId)
|
||||
boundary.AddBrokeredCredentialSourceToTargetCli(t, ctx, newTargetId, newCredentialLibraryId)
|
||||
|
||||
// Get credentials for target
|
||||
output = e2e.RunCommand(ctx, "boundary",
|
||||
|
||||
@@ -145,8 +145,8 @@ func TestCliVaultCredentialStore(t *testing.T) {
|
||||
require.True(t, newSessionAuthorizationResult.Item.Credentials == nil)
|
||||
|
||||
// Add credentials to target
|
||||
boundary.AddCredentialSourceToTargetCli(t, ctx, newTargetId, newPrivateKeyCredentialLibraryId)
|
||||
boundary.AddCredentialSourceToTargetCli(t, ctx, newTargetId, newPasswordCredentialLibraryId)
|
||||
boundary.AddBrokeredCredentialSourceToTargetCli(t, ctx, newTargetId, newPrivateKeyCredentialLibraryId)
|
||||
boundary.AddBrokeredCredentialSourceToTargetCli(t, ctx, newTargetId, newPasswordCredentialLibraryId)
|
||||
|
||||
// Get credentials for target
|
||||
output = e2e.RunCommand(ctx, "boundary",
|
||||
|
||||
@@ -221,7 +221,7 @@ func populateBoundaryDatabase(t testing.TB, ctx context.Context, c *config, te T
|
||||
boundary.CreateNewStaticCredentialPasswordCli(t, ctx, newCredentialStoreId, c.TargetSshUser, "password")
|
||||
boundary.CreateNewStaticCredentialJsonCli(t, ctx, newCredentialStoreId, "testdata/credential.json")
|
||||
newCredentialsId := boundary.CreateNewStaticCredentialPrivateKeyCli(t, ctx, newCredentialStoreId, c.TargetSshUser, c.TargetSshKeyPath)
|
||||
boundary.AddCredentialSourceToTargetCli(t, ctx, newTargetId, newCredentialsId)
|
||||
boundary.AddBrokeredCredentialSourceToTargetCli(t, ctx, newTargetId, newCredentialsId)
|
||||
|
||||
// Create vault credentials
|
||||
boundaryPolicyName, kvPolicyFilePath := vault.Setup(t)
|
||||
|
||||
Reference in new issue
Block a user