MCPcopy Create free account
hub / github.com/PostHog/duckgres / TestTransactionErrorStatus

Function TestTransactionErrorStatus

server/conn_test.go:532–553  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

530 }
531}
532
533func TestTransactionErrorStatus(t *testing.T) {
534 c := &clientConn{txStatus: txStatusIdle}
535
536 // Error outside transaction should not change status
537 c.setTxError()
538 if c.txStatus != txStatusIdle {
539 t.Errorf("error outside transaction txStatus = %c, want %c", c.txStatus, txStatusIdle)
540 }
541
542 // Error inside transaction should set to error
543 c.updateTxStatus("BEGIN")
544 c.setTxError()
545 if c.txStatus != txStatusError {
546 t.Errorf("error inside transaction txStatus = %c, want %c", c.txStatus, txStatusError)
547 }
548
549 // ROLLBACK should recover from error state
550 c.updateTxStatus("ROLLBACK")
551 if c.txStatus != txStatusIdle {
552 t.Errorf("after ROLLBACK from error txStatus = %c, want %c", c.txStatus, txStatusIdle)
553 }
554}
555
556func TestNestedBeginDetection(t *testing.T) {

Callers

nothing calls this directly

Calls 2

setTxErrorMethod · 0.95
updateTxStatusMethod · 0.95

Tested by

no test coverage detected