From 4692b1478e4a718cd3509a834ccfa19a8ed49415 Mon Sep 17 00:00:00 2001 From: Preetha Appan Date: Wed, 26 Jul 2017 09:42:07 -0500 Subject: [PATCH] Add extra test case for deleting entire tree with empty prefix --- agent/consul/state/kvs_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/agent/consul/state/kvs_test.go b/agent/consul/state/kvs_test.go index 1b17d6585..36db7ac7b 100644 --- a/agent/consul/state/kvs_test.go +++ b/agent/consul/state/kvs_test.go @@ -1107,6 +1107,20 @@ func TestStateStore_Watches_PrefixDelete(t *testing.T) { if got != wantIndex { t.Fatalf("bad index: %d, expected %d", got, wantIndex) } + + // Delete all the keys, special case where tombstones are not inserted + if err := s.KVSDeleteTree(9, ""); err != nil { + t.Fatalf("unexpected err: %s", err) + } + wantIndex = 9 + got, _, err = s.KVSList(nil, "/foo/bar") + if err != nil { + t.Fatalf("err: %s", err) + } + if got != wantIndex { + t.Fatalf("bad index: %d, expected %d", got, wantIndex) + } + } func TestStateStore_KVSLockDelay(t *testing.T) {