From 7736e701ca1d053de2277a450c64748fc15097aa Mon Sep 17 00:00:00 2001 From: Armon Dadgar Date: Thu, 18 Dec 2014 15:19:35 -0800 Subject: [PATCH] consul: Test FSM restore of tombstones --- consul/fsm_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/consul/fsm_test.go b/consul/fsm_test.go index 9db2c8c3a..8de6db7b0 100644 --- a/consul/fsm_test.go +++ b/consul/fsm_test.go @@ -357,6 +357,12 @@ func TestFSM_SnapshotRestore(t *testing.T) { acl := &structs.ACL{ID: generateUUID(), Name: "User Token"} fsm.state.ACLSet(10, acl) + fsm.state.KVSSet(11, &structs.DirEntry{ + Key: "/remove", + Value: []byte("foo"), + }) + fsm.state.KVSDelete(12, "/remove") + // Snapshot snap, err := fsm.Snapshot() if err != nil { @@ -446,6 +452,15 @@ func TestFSM_SnapshotRestore(t *testing.T) { if idx <= 1 { t.Fatalf("bad index: %d", idx) } + + // Verify tombstones are restored + _, res, err := fsm.state.tombstoneTable.Get("id", "/remove") + if err != nil { + t.Fatalf("err: %v", err) + } + if len(res) != 1 { + t.Fatalf("bad: %v", res) + } } func TestFSM_KVSSet(t *testing.T) {