test: Update tests to account for deprecated features in 0.14.0 (#3776)

* chore: Fix comment typo

* test(e2e): Update to use new credential library type

* test(e2e): Update to use new field name

* test(bats): Remove tests that use deprecated subcommand

* chore: Update to 0.14.0

* test(credentiallibraries): Update to use new credential library type

* doc: Add deprecation notices for 0.14.0

* fixup! doc: Add deprecation notices for 0.14.0
This commit is contained in:
Michael Li authored and GitHub committed 2023-09-26 10:33:53 -04:00
1 parent 2d8d992500
commit dc912e2a86
13 files changed
+28 -112

No files matched your search

+9
View File
@@ -4,6 +4,15 @@ Canonical reference for changes, improvements, and bugfixes for Boundary.
## Next
### Deprecations/Changes
* Per the note in Boundary 0.12.0, the `vault` credential library subtype has now been
removed in favor of `vault-generic`. For example, instead of `boundary
credential-libraries create vault`, you must use `boundary
credential-libraries create vault-generic`.
* Per the note in Boundary 0.12.0, errors returned from the cli when using the
`-format=json` option will now only use the `status_code` field. The `status`
field has been removed.
### New and Improved
* cli: Add support for specifying a command that will be executed on the remote host when
@@ -781,7 +781,7 @@ func TestCreate(t *testing.T) {
name: "Create a valid vault CredentialLibrary with the 'vault' subtype",
req: &pbs.CreateCredentialLibraryRequest{Item: &pb.CredentialLibrary{
CredentialStoreId: store.GetPublicId(),
Type: vault.Subtype.String(),
Type: vault.GenericLibrarySubtype.String(),
Attrs: &pb.CredentialLibrary_VaultCredentialLibraryAttributes{
VaultCredentialLibraryAttributes: &pb.VaultCredentialLibraryAttributes{
Path: wrapperspb.String("something"),
@@ -809,42 +809,6 @@ func TestCreate(t *testing.T) {
},
},
},
{
name: "Create a valid vault CredentialLibrary with no type set subtype",
req: &pbs.CreateCredentialLibraryRequest{
Item: &pb.CredentialLibrary{
CredentialStoreId: store.GetPublicId(),
Type: "",
Attrs: &pb.CredentialLibrary_Attributes{
Attributes: &structpb.Struct{
Fields: map[string]*structpb.Value{
"path": structpb.NewStringValue("something"),
},
},
},
},
},
idPrefix: globals.VaultCredentialLibraryPrefix + "_",
res: &pbs.CreateCredentialLibraryResponse{
Uri: fmt.Sprintf("credential-libraries/%s_", globals.VaultCredentialLibraryPrefix),
Item: &pb.CredentialLibrary{
Id: store.GetPublicId(),
CredentialStoreId: store.GetPublicId(),
CreatedTime: store.GetCreateTime().GetTimestamp(),
UpdatedTime: store.GetUpdateTime().GetTimestamp(),
Scope: &scopepb.ScopeInfo{Id: prj.GetPublicId(), Type: prj.GetType(), ParentScopeId: prj.GetParentId()},
Version: 1,
Type: vault.GenericLibrarySubtype.String(),
Attrs: &pb.CredentialLibrary_VaultGenericCredentialLibraryAttributes{
VaultGenericCredentialLibraryAttributes: &pb.VaultCredentialLibraryAttributes{
Path: wrapperspb.String("something"),
HttpMethod: wrapperspb.String("GET"),
},
},
AuthorizedActions: testAuthorizedActions,
},
},
},
}
for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
@@ -48,7 +48,7 @@ func TestList(t *testing.T) {
expected = append(expected, &credentiallibraries.CredentialLibrary{Name: fmt.Sprint(i), Attributes: map[string]any{"vault_path": "something"}})
}
cl, err := lClient.Create(tc.Context(), cs.Item.Type, cs.Item.Id, credentiallibraries.WithName(expected[0].Name), credentiallibraries.WithVaultCredentialLibraryPath("something"))
cl, err := lClient.Create(tc.Context(), "vault-generic", cs.Item.Id, credentiallibraries.WithName(expected[0].Name), credentiallibraries.WithVaultCredentialLibraryPath("something"))
require.NoError(err)
expected[0] = cl.Item
@@ -57,7 +57,7 @@ func TestList(t *testing.T) {
assert.ElementsMatch(comparableSetSlice(expected[:1]), comparableSetSlice(ul.Items))
for i := 1; i < 10; i++ {
cl, err = lClient.Create(tc.Context(), cs.Item.Type, cs.Item.Id, credentiallibraries.WithName(expected[i].Name), credentiallibraries.WithVaultCredentialLibraryPath("something"))
cl, err = lClient.Create(tc.Context(), "vault-generic", cs.Item.Id, credentiallibraries.WithName(expected[i].Name), credentiallibraries.WithVaultCredentialLibraryPath("something"))
require.NoError(err)
expected[i] = cl.Item
}
@@ -119,7 +119,7 @@ func TestCrud(t *testing.T) {
lClient := credentiallibraries.NewClient(client)
r, err := lClient.Create(tc.Context(), cs.Item.Type, cs.Item.Id, credentiallibraries.WithName("foo"),
r, err := lClient.Create(tc.Context(), "vault-generic", cs.Item.Id, credentiallibraries.WithName("foo"),
credentiallibraries.WithVaultCredentialLibraryPath("something"))
require.Nil(err)
checkResource(t, "create", r.Item, err, "foo", 1)
@@ -162,7 +162,7 @@ func TestErrors(t *testing.T) {
lClient := credentiallibraries.NewClient(client)
l, err := lClient.Create(tc.Context(), cs.Item.Type, cs.Item.Id, credentiallibraries.WithName("foo"),
l, err := lClient.Create(tc.Context(), "vault-generic", cs.Item.Id, credentiallibraries.WithName("foo"),
credentiallibraries.WithVaultCredentialLibraryPath("something"))
require.NoError(err)
assert.NotNil(l)
+2 -2
View File
@@ -91,11 +91,11 @@ func TestCredentialSourcesASD(t *testing.T) {
require.NotNil(csVault)
lClient := credentiallibraries.NewClient(client)
lib1, err := lClient.Create(tc.Context(), csVault.Item.Type, csVault.Item.Id, credentiallibraries.WithVaultCredentialLibraryPath("something1"))
lib1, err := lClient.Create(tc.Context(), "vault-generic", csVault.Item.Id, credentiallibraries.WithVaultCredentialLibraryPath("something1"))
require.NoError(err)
require.NotNil(lib1)
lib2, err := lClient.Create(tc.Context(), csVault.Item.Type, csVault.Item.Id, credentiallibraries.WithVaultCredentialLibraryPath("something2"))
lib2, err := lClient.Create(tc.Context(), "vault-generic", csVault.Item.Id, credentiallibraries.WithVaultCredentialLibraryPath("something2"))
require.NoError(err)
require.NotNil(lib2)
@@ -93,63 +93,6 @@ export NEW_VAULT_LIB="test_vault"
[ "$status" -eq 0 ]
}
@test "boundary/credential-libraries: can create $NEW_VAULT_LIB vault library in credential store $NEW_STORE deprecated subcommand" {
skip_if_no_vault
local csid=$(credential_store_id $NEW_STORE $DEFAULT_P_ID)
run create_vault_library \
-name $NEW_VAULT_LIB -credential-store-id $csid \
-vault-path /kv/secret \
-vault-http-method GET
echo "$output"
[ "$status" -eq 0 ]
local clid=$(credential_library_id $NEW_VAULT_LIB $csid)
run read_credential_library $clid
echo "$output"
[ "$status" -eq 0 ]
got=$(echo "$output")
run field_eq "$got" ".item.attributes.path" '"/kv/secret"'
[ "$status" -eq 0 ]
run field_eq "$got" ".item.attributes.http_method" '"GET"'
[ "$status" -eq 0 ]
}
@test "boundary/credential-libraries: can not create already created $NEW_VAULT_LIB vault libary deprecated subcommand" {
skip_if_no_vault
local csid=$(credential_store_id $NEW_STORE $DEFAULT_P_ID)
run create_vault_library \
-name $NEW_VAULT_LIB -credential-store-id $csid \
-vault-path /kv/secret \
-vault-http-method GET
echo "$output"
[ "$status" -eq 1 ]
}
@test "boundary/credential-libraries: can read $NEW_VAULT_LIB vault library depcrecated subcommand" {
skip_if_no_vault
local csid=$(credential_store_id $NEW_STORE $DEFAULT_P_ID)
local clid=$(credential_library_id $NEW_VAULT_LIB $csid)
run read_credential_library $clid
echo "$output"
[ "$status" -eq 0 ]
}
@test "boundary/credential-libraries: can delete $NEW_VAULT_LIB vault library depcrecated subcommand" {
skip_if_no_vault
local csid=$(credential_store_id $NEW_STORE $DEFAULT_P_ID)
local clid=$(credential_library_id $NEW_VAULT_LIB $csid)
run delete_credential_library $clid
echo "$output"
[ "$status" -eq 0 ]
run has_status_code "$output" "204"
[ "$status" -eq 0 ]
}
@test "boundary/credential-libraries: can create $NEW_VAULT_LIB vault-ssh-certificate library in credential store $NEW_STORE" {
skip_if_no_vault
+1 -1
View File
@@ -34,5 +34,5 @@ type DbInitInfo struct {
// CliError parses the Stderr from running a boundary command
type CliError struct {
Status int `json:"status"`
Status int `json:"status_code"`
}
@@ -102,7 +102,7 @@ func TestCliVaultCredentialStore(t *testing.T) {
// Create a credential library for the private key
output = e2e.RunCommand(ctx, "boundary",
e2e.WithArgs(
"credential-libraries", "create", "vault",
"credential-libraries", "create", "vault-generic",
"-credential-store-id", newCredentialStoreId,
"-vault-path", c.VaultSecretPath+"/data/"+privateKeySecretName,
"-name", "e2e Automated Test Vault Credential Library - Private Key",
@@ -120,7 +120,7 @@ func TestCliVaultCredentialStore(t *testing.T) {
// Create a credential library for the password
output = e2e.RunCommand(ctx, "boundary",
e2e.WithArgs(
"credential-libraries", "create", "vault",
"credential-libraries", "create", "vault-generic",
"-credential-store-id", newCredentialStoreId,
"-vault-path", c.VaultSecretPath+"/data/"+passwordSecretName,
"-name", "e2e Automated Test Vault Credential Library - Password",
@@ -259,7 +259,7 @@ func TestApiVaultCredentialStore(t *testing.T) {
// Create a credential library for the private key
clClient := credentiallibraries.NewClient(client)
newCredentialLibraryResult, err := clClient.Create(ctx, "vault", newCredentialStoreId,
newCredentialLibraryResult, err := clClient.Create(ctx, "vault-generic", newCredentialStoreId,
credentiallibraries.WithVaultCredentialLibraryPath(c.VaultSecretPath+"/data/"+privateKeySecretName),
credentiallibraries.WithCredentialType("ssh_private_key"),
)
@@ -268,7 +268,7 @@ func TestApiVaultCredentialStore(t *testing.T) {
t.Logf("Created Credential Library: %s", newPrivateKeyCredentialLibraryId)
// Create a credential library for the password
newCredentialLibraryResult, err = clClient.Create(ctx, "vault", newCredentialStoreId,
newCredentialLibraryResult, err = clClient.Create(ctx, "vault-generic", newCredentialStoreId,
credentiallibraries.WithVaultCredentialLibraryPath(c.VaultSecretPath+"/data/"+passwordSecretName),
credentiallibraries.WithCredentialType("username_password"),
)
@@ -103,7 +103,7 @@ func TestCliTcpTargetVaultConnectTarget(t *testing.T) {
// Create a credential library
output = e2e.RunCommand(ctx, "boundary",
e2e.WithArgs(
"credential-libraries", "create", "vault",
"credential-libraries", "create", "vault-generic",
"-credential-store-id", newCredentialStoreId,
"-vault-path", fmt.Sprintf("%s/data/%s", c.VaultSecretPath, privateKeySecretName),
"-name", "e2e Automated Test Vault Credential Library",
@@ -100,7 +100,7 @@ func TestCliTcpTargetWorkerConnectTarget(t *testing.T) {
// Create a credential library
output = e2e.RunCommand(ctx, "boundary",
e2e.WithArgs(
"credential-libraries", "create", "vault",
"credential-libraries", "create", "vault-generic",
"-credential-store-id", newCredentialStoreId,
"-vault-path", fmt.Sprintf("%s/data/%s", c.VaultSecretPath, privateKeySecretName),
"-name", "e2e Automated Test Vault Credential Library",
@@ -270,7 +270,7 @@ func populateBoundaryDatabase(t testing.TB, ctx context.Context, c *config, te T
// Create a credential library for the private key in vault
output = e2e.RunCommand(ctx, "boundary",
e2e.WithArgs(
"credential-libraries", "create", "vault",
"credential-libraries", "create", "vault-generic",
"-credential-store-id", newVaultCredentialStoreId,
"-vault-path", c.VaultSecretPath+"/data/"+privateKeySecretName,
"-name", "e2e Automated Test Vault Credential Library",
@@ -288,7 +288,7 @@ func populateBoundaryDatabase(t testing.TB, ctx context.Context, c *config, te T
// Create a credential library for the password in vault
output = e2e.RunCommand(ctx, "boundary",
e2e.WithArgs(
"credential-libraries", "create", "vault",
"credential-libraries", "create", "vault-generic",
"-credential-store-id", newVaultCredentialStoreId,
"-vault-path", c.VaultSecretPath+"/data/"+passwordSecretName,
"-name", "e2e Automated Test Vault Credential Library - Password",
+1 -1
View File
@@ -1 +1 @@
0.13.2
0.14.0
+1 -1
View File
@@ -60,7 +60,7 @@ func init() {
// UseTargetIdForHostId supports old CLI clients that are unaware of host-sourceless targets,
// this feature populates the target's public id into the AuthorizeSessionResponse
// and the SessionAuthroizationData so the CLI can properly build the ssh command
// and the SessionAuthorizationData so the CLI can properly build the ssh command
// when calling "boundary connect ssh..."
featureMap[UseTargetIdForHostId] = MetadataConstraint{
Constraints: mustNewConstraints("< 0.14.0"),
+1 -1
View File
@@ -13,7 +13,7 @@ var (
// Version is the base version
// Default values - set when building locally (at build time)
Version = "0.13.2"
Version = "0.14.0"
// VersionPrerelease is also set at compile time, similarly to Version.
VersionPrerelease string