TestReAuthRespectsClosed verifies that re-auth doesn't happen on closed connections.
(t *testing.T)
| 217 | |
| 218 | // TestReAuthRespectsClosed verifies that re-auth doesn't happen on closed connections. |
| 219 | func TestReAuthRespectsClosed(t *testing.T) { |
| 220 | // Create a connection |
| 221 | cn := pool.NewConn(nil) |
| 222 | |
| 223 | // Initialize to IDLE state |
| 224 | cn.GetStateMachine().Transition(pool.StateInitializing) |
| 225 | cn.GetStateMachine().Transition(pool.StateIdle) |
| 226 | |
| 227 | // Close the connection |
| 228 | cn.GetStateMachine().Transition(pool.StateClosed) |
| 229 | |
| 230 | // Try to transition to UNUSABLE - should fail |
| 231 | _, err := cn.GetStateMachine().TryTransition([]pool.ConnState{pool.StateIdle}, pool.StateUnusable) |
| 232 | if err == nil { |
| 233 | t.Error("Expected error when trying to transition CLOSED → UNUSABLE, but got none") |
| 234 | } |
| 235 | |
| 236 | // Verify state is still CLOSED |
| 237 | if state := cn.GetStateMachine().GetState(); state != pool.StateClosed { |
| 238 | t.Errorf("Expected state to remain CLOSED, got %s", state) |
| 239 | } |
| 240 | } |
nothing calls this directly
no test coverage detected