Skip to content

Commit

Permalink
fs: do not return an error if delete succeeds
Browse files Browse the repository at this point in the history
This commit fixes a bug in the FS key store.
When a delete occurs the FS key store used to
always return `errDeleteKey` even if the operation
succeeded.

This commit fixes this incorrect behavior.
  • Loading branch information
Andreas Auernhammer committed Nov 30, 2020
1 parent 1733747 commit 63074f4
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,28 @@ func TestCreateKey(t *testing.T) {
}
}

func TestDeleteKey(t *testing.T) {
if !*IsIntegrationTest {
t.SkipNow()
}

client, err := newClient()
if err != nil {
t.Fatalf("Failed to create KES client: %v", err)
}

key := fmt.Sprintf("KES-test-%x", sioutil.MustRandom(12))
if err := client.CreateKey(key); err != nil {
t.Fatalf("Failed to create key '%s': %v", key, err)
}
if err := client.DeleteKey(key); err != nil {
t.Fatalf("Failed to delete key '%s': %v", key, err)
}
if err := client.DeleteKey(key); err != nil {
t.Fatalf("Failed to delete key '%s' a 2nd time: %v", key, err)
}
}

var importKeyTests = []struct {
Key []byte

Expand Down

0 comments on commit 63074f4

Please sign in to comment.