Skip to content

Commit

Permalink
Clean up rotated test keys
Browse files Browse the repository at this point in the history
  • Loading branch information
F21 committed Mar 26, 2024
1 parent 8cf307f commit 35f70fc
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions path_config_rotate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ func TestPathConfigRotateRoot(t *testing.T) {

defer func() {
err := key.Delete(context.Background())

if err != nil {
t.Fatalf("Unable to delete test rotation key: %s", err)
t.Errorf("Unable to delete test rotation key: %s", err)
}
}()

Expand Down Expand Up @@ -88,4 +87,13 @@ func TestPathConfigRotateRoot(t *testing.T) {
if config.ApplicationKey == key.Secret() {
t.Fatal("old and new application keys are equal after rotate-root, it shouldn't be")
}

keys, _, err := client.ListKeys(context.Background(), 1, config.ApplicationKeyId)
for _, currentKey := range keys {
if currentKey.ID() == config.ApplicationKeyId {
if err = currentKey.Delete(context.Background()); err != nil {
t.Errorf("Unable to delete rotated key: %s", err)
}
}
}
}

0 comments on commit 35f70fc

Please sign in to comment.