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

Function TestTransactionStatusWithCopyCommands

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

Source from the content-addressed store, hash-verified

3635}
3636
3637func TestCursorCloseAllCursors(t *testing.T) {
3638 c := &clientConn{
3639 cursors: map[string]*cursorState{
3640 "cur1": {query: "SELECT 1"},
3641 "cur2": {query: "SELECT 2"},
3642 "cur3": {query: "SELECT 3"},
3643 },
3644 }
3645
3646 if len(c.cursors) != 3 {
3647 t.Fatalf("expected 3 cursors, got %d", len(c.cursors))
3648 }
3649
3650 c.closeAllCursors()
3651
3652 if len(c.cursors) != 0 {
3653 t.Errorf("after closeAllCursors, expected 0 cursors, got %d", len(c.cursors))
3654 }
3655}
3656
3657func TestCursorCloseSingle(t *testing.T) {
3658 c := &clientConn{
3659 cursors: map[string]*cursorState{
3660 "cur1": {query: "SELECT 1"},
3661 "cur2": {query: "SELECT 2"},
3662 },
3663 }
3664
3665 c.closeCursor("cur1")
3666
3667 if len(c.cursors) != 1 {
3668 t.Errorf("expected 1 cursor remaining, got %d", len(c.cursors))
3669 }
3670 if _, ok := c.cursors["cur2"]; !ok {
3671 t.Error("expected cur2 to still exist")
3672 }

Callers

nothing calls this directly

Calls 1

updateTxStatusMethod · 0.95

Tested by

no test coverage detected