From 4836fe93a52edc3418710b148fb5c4c226be48e0 Mon Sep 17 00:00:00 2001 From: Nick Cabatoff Date: Sat, 15 Aug 2020 11:15:38 -0400 Subject: [PATCH] Ensure that deletion of a non-existent key does not produce an error. --- test/basic_tests.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/basic_tests.go b/test/basic_tests.go index fd4798a..434abc5 100644 --- a/test/basic_tests.go +++ b/test/basic_tests.go @@ -126,13 +126,18 @@ func SubtestNotFounds(t *testing.T, ds dstore.Datastore) { switch err { case dstore.ErrNotFound: case nil: - t.Fatal("expected error getting size after delete") + t.Fatal("expected error getting size of not found key") default: - t.Fatal("wrong error getting size after delete: ", err) + t.Fatal("wrong error getting size of not found key", err) } if size != -1 { t.Fatal("expected missing size to be -1") } + + err = ds.Delete(badk) + if err != nil { + t.Fatal("error calling delete on not found key: ", err) + } } func SubtestLimit(t *testing.T, ds dstore.Datastore) {