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:
1 parent
2d8d992500
commit
dc912e2a86
13 files changed
+42
-126
No files matched your search
+1
-37
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in new issue
Block a user