builtin/credential/approle: fix dropped test errors (#11990)

This commit is contained in:
Lars Lehtonen 2021-07-05 08:00:12 -07:00 committed by GitHub
parent 8201b42651
commit 159272db7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 3 deletions

View File

@ -209,6 +209,9 @@ func TestAppRole_LocalSecretIDImmutability(t *testing.T) {
Storage: storage,
Data: roleData,
})
if err != nil {
t.Fatal(err)
}
if resp == nil || !resp.IsError() {
t.Fatalf("expected an error since local_secret_ids can't be overwritten")
}

View File

@ -44,21 +44,26 @@ func TestAppRole_TidyDanglingAccessors_Normal(t *testing.T) {
SecretIDHMAC: "samplesecretidhmac",
},
)
err = storage.Put(context.Background(), entry1)
if err != nil {
t.Fatal(err)
}
if err := storage.Put(context.Background(), entry1); err != nil {
t.Fatal(err)
}
entry2, err := logical.StorageEntryJSON(
"accessor/invalid2",
&secretIDAccessorStorageEntry{
SecretIDHMAC: "samplesecretidhmac2",
},
)
err = storage.Put(context.Background(), entry2)
if err != nil {
t.Fatal(err)
}
if err := storage.Put(context.Background(), entry2); err != nil {
t.Fatal(err)
}
accessorHashes, err = storage.List(context.Background(), "accessor/")
if err != nil {
@ -138,11 +143,14 @@ func TestAppRole_TidyDanglingAccessors_RaceTest(t *testing.T) {
SecretIDHMAC: "samplesecretidhmac",
},
)
err = storage.Put(context.Background(), entry)
if err != nil {
t.Fatal(err)
}
if err := storage.Put(context.Background(), entry); err != nil {
t.Fatal(err)
}
count++
time.Sleep(100 * time.Microsecond)
}