mirror of
https://github.com/status-im/consul.git
synced 2025-02-16 23:57:07 +00:00
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"}
|
acl := &structs.ACL{ID: generateUUID(), Name: "User Token"}
|
||||||
fsm.state.ACLSet(10, acl)
|
fsm.state.ACLSet(10, acl)
|
||||||
|
|
||||||
|
fsm.state.KVSSet(11, &structs.DirEntry{
|
||||||
|
Key: "/remove",
|
||||||
|
Value: []byte("foo"),
|
||||||
|
})
|
||||||
|
fsm.state.KVSDelete(12, "/remove")
|
||||||
|
|
||||||
// Snapshot
|
// Snapshot
|
||||||
snap, err := fsm.Snapshot()
|
snap, err := fsm.Snapshot()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -446,6 +452,15 @@ func TestFSM_SnapshotRestore(t *testing.T) {
|
|||||||
if idx <= 1 {
|
if idx <= 1 {
|
||||||
t.Fatalf("bad index: %d", idx)
|
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) {
|
func TestFSM_KVSSet(t *testing.T) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user