mirror of https://github.com/status-im/consul.git
consul: Test FSM restore of tombstones
This commit is contained in:
parent
2a388aa354
commit
c22f172d84
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue