diff --git a/command/agent/session_endpoint_test.go b/command/agent/session_endpoint_test.go index 86bb7243bd..1843bcb837 100644 --- a/command/agent/session_endpoint_test.go +++ b/command/agent/session_endpoint_test.go @@ -239,7 +239,7 @@ func TestSessionTTL(t *testing.T) { t.Fatalf("Incorrect TTL: %s", respObj[0].TTL) } - time.Sleep(ttl * structs.SessionTTLMultiplier + ttl) + time.Sleep(ttl*structs.SessionTTLMultiplier + ttl) req, err = http.NewRequest("GET", "/v1/session/info/"+id, nil) diff --git a/consul/state_store_test.go b/consul/state_store_test.go index 210ef24c59..c933dbdb0d 100644 --- a/consul/state_store_test.go +++ b/consul/state_store_test.go @@ -798,16 +798,14 @@ func TestStoreSnapshot(t *testing.T) { t.Fatalf("missing sessions") } - // Check there is 1 session with TTL - sessions, err = snap.SessionListTTL() - if err != nil { - t.Fatalf("err: %v", err) + ttls := 0 + for _, session := range sessions { + if session.TTL != "" { + ttls++ + } } - - if len(sessions) < 1 { - t.Fatalf("missing TTL session") - } else if len(sessions) > 1 { - t.Fatalf("too many TTL sessions") + if ttls != 1 { + t.Fatalf("Wrong number of sessions with TTL") } // Check for an acl