From aa97e24b029a3915c6293cd8f796246ef58db453 Mon Sep 17 00:00:00 2001 From: Armon Dadgar Date: Thu, 15 May 2014 19:57:48 -0700 Subject: [PATCH] consul: Testing FSM snapshot of sessions --- consul/fsm_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/consul/fsm_test.go b/consul/fsm_test.go index c6a427b744..5e5d086d84 100644 --- a/consul/fsm_test.go +++ b/consul/fsm_test.go @@ -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) {