From 7729b66099f874804a6d5d6dc0926195a8cc741d Mon Sep 17 00:00:00 2001 From: James Phillips Date: Mon, 12 Oct 2015 20:56:17 -0700 Subject: [PATCH] Integrates session TTL tests with new state store. --- consul/session_ttl_test.go | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/consul/session_ttl_test.go b/consul/session_ttl_test.go index 4f855c654e..1bdc41c7e1 100644 --- a/consul/session_ttl_test.go +++ b/consul/session_ttl_test.go @@ -19,8 +19,10 @@ func TestInitializeSessionTimers(t *testing.T) { testutil.WaitForLeader(t, s1.RPC, "dc1") - state := s1.fsm.State() - state.EnsureNode(1, structs.Node{Node: "foo", Address: "127.0.0.1"}) + state := s1.fsm.StateNew() + if err := state.EnsureNode(1, &structs.Node{Node: "foo", Address: "127.0.0.1"}); err != nil { + t.Fatalf("err: %s", err) + } session := &structs.Session{ ID: generateUUID(), Node: "foo", @@ -57,8 +59,10 @@ func TestResetSessionTimer_Fault(t *testing.T) { } // Create a session - state := s1.fsm.State() - state.EnsureNode(1, structs.Node{Node: "foo", Address: "127.0.0.1"}) + state := s1.fsm.StateNew() + if err := state.EnsureNode(1, &structs.Node{Node: "foo", Address: "127.0.0.1"}); err != nil { + t.Fatalf("err: %s", err) + } session := &structs.Session{ ID: generateUUID(), Node: "foo", @@ -89,8 +93,10 @@ func TestResetSessionTimer_NoTTL(t *testing.T) { testutil.WaitForLeader(t, s1.RPC, "dc1") // Create a session - state := s1.fsm.State() - state.EnsureNode(1, structs.Node{Node: "foo", Address: "127.0.0.1"}) + state := s1.fsm.StateNew() + if err := state.EnsureNode(1, &structs.Node{Node: "foo", Address: "127.0.0.1"}); err != nil { + t.Fatalf("err: %s", err) + } session := &structs.Session{ ID: generateUUID(), Node: "foo", @@ -200,8 +206,10 @@ func TestInvalidateSession(t *testing.T) { testutil.WaitForLeader(t, s1.RPC, "dc1") // Create a session - state := s1.fsm.State() - state.EnsureNode(1, structs.Node{Node: "foo", Address: "127.0.0.1"}) + state := s1.fsm.StateNew() + if err := state.EnsureNode(1, &structs.Node{Node: "foo", Address: "127.0.0.1"}); err != nil { + t.Fatalf("err: %s", err) + } session := &structs.Session{ ID: generateUUID(), Node: "foo",