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

Function TestSessionTransactionCommands

tests/integration/session_test.go:207–244  ·  view source on GitHub ↗

TestSessionTransactionCommands tests transaction control commands

(t *testing.T)

Source from the content-addressed store, hash-verified

205
206// TestSessionTransactionCommands tests transaction control commands
207func TestSessionTransactionCommands(t *testing.T) {
208 tests := []struct {
209 name string
210 queries []string
211 }{
212 {
213 name: "begin_commit",
214 queries: []string{"BEGIN", "SELECT 1", "COMMIT"},
215 },
216 {
217 name: "begin_rollback",
218 queries: []string{"BEGIN", "SELECT 1", "ROLLBACK"},
219 },
220 {
221 name: "begin_transaction",
222 queries: []string{"BEGIN TRANSACTION", "SELECT 1", "COMMIT"},
223 },
224 {
225 name: "start_transaction",
226 queries: []string{"START TRANSACTION", "SELECT 1", "COMMIT"},
227 },
228 {
229 name: "end_as_commit",
230 queries: []string{"BEGIN", "SELECT 1", "END"},
231 },
232 }
233
234 for _, tt := range tests {
235 t.Run(tt.name, func(t *testing.T) {
236 for _, q := range tt.queries {
237 _, err := testHarness.DuckgresDB.Exec(q)
238 if err != nil {
239 t.Errorf("Query %q failed: %v", q, err)
240 }
241 }
242 })
243 }
244}
245
246// TestSessionTransactionModes tests transaction mode commands
247func TestSessionTransactionModes(t *testing.T) {

Callers

nothing calls this directly

Calls 2

RunMethod · 0.65
ExecMethod · 0.65

Tested by

no test coverage detected