Skip to content

Commit

Permalink
builtin/credential/approle: fix dropped test errors (#11990)
Browse files Browse the repository at this point in the history
  • Loading branch information
alrs authored Jul 5, 2021
1 parent e38d622 commit adc55cc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
3 changes: 3 additions & 0 deletions builtin/credential/approle/path_role_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
14 changes: 11 additions & 3 deletions builtin/credential/approle/path_tidy_user_id_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit adc55cc

Please sign in to comment.