MCPcopy Create free account
hub / github.com/dan-v/lambda-nat-proxy / TestSession_RoleMethods

Function TestSession_RoleMethods

internal/manager/manager_test.go:10–47  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestSession_RoleMethods(t *testing.T) {
11 session := &Session{
12 ID: "test-session",
13 Role: RolePrimary,
14 }
15
16 if !session.IsPrimary() {
17 t.Error("Expected session to be primary")
18 }
19 if session.IsSecondary() {
20 t.Error("Expected session not to be secondary")
21 }
22 if session.IsDraining() {
23 t.Error("Expected session not to be draining")
24 }
25
26 session.Role = RoleSecondary
27 if session.IsPrimary() {
28 t.Error("Expected session not to be primary")
29 }
30 if !session.IsSecondary() {
31 t.Error("Expected session to be secondary")
32 }
33 if session.IsDraining() {
34 t.Error("Expected session not to be draining")
35 }
36
37 session.Role = RoleDraining
38 if session.IsPrimary() {
39 t.Error("Expected session not to be primary")
40 }
41 if session.IsSecondary() {
42 t.Error("Expected session not to be secondary")
43 }
44 if !session.IsDraining() {
45 t.Error("Expected session to be draining")
46 }
47}
48
49func TestSession_RemainingTTL(t *testing.T) {
50 session := &Session{

Callers

nothing calls this directly

Calls 4

IsPrimaryMethod · 0.95
IsSecondaryMethod · 0.95
IsDrainingMethod · 0.95
ErrorMethod · 0.80

Tested by

no test coverage detected