(t *testing.T)
| 8 | ) |
| 9 | |
| 10 | func 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 | |
| 49 | func TestSession_RemainingTTL(t *testing.T) { |
| 50 | session := &Session{ |
nothing calls this directly
no test coverage detected