mirror of
https://github.com/status-im/consul.git
synced 2025-02-23 02:48:19 +00:00
consul: Testing FSM snapshot of sessions
This commit is contained in:
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…
x
Reference in New Issue
Block a user