mirror of https://github.com/hashicorp/consul
consul: Testing FSM snapshot of sessions
parent
555533e2f8
commit
aa97e24b02
|
@ -326,6 +326,8 @@ func TestFSM_SnapshotRestore(t *testing.T) {
|
|||
Key: "/test",
|
||||
Value: []byte("foo"),
|
||||
})
|
||||
session := &structs.Session{Node: "foo"}
|
||||
fsm.state.SessionCreate(9, session)
|
||||
|
||||
// Snapshot
|
||||
snap, err := fsm.Snapshot()
|
||||
|
@ -383,6 +385,15 @@ func TestFSM_SnapshotRestore(t *testing.T) {
|
|||
if string(d.Value) != "foo" {
|
||||
t.Fatalf("bad: %v", d)
|
||||
}
|
||||
|
||||
// Verify session is restored
|
||||
_, s, err := fsm.state.SessionGet(session.ID)
|
||||
if err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
if s.Node != "foo" {
|
||||
t.Fatalf("bad: %v", d)
|
||||
}
|
||||
}
|
||||
|
||||
func TestFSM_KVSSet(t *testing.T) {
|
||||
|
|
Loading…
Reference in New Issue