func testBeginPanics(t *testing.T, conn tabletconn.TabletConn, f *FakeQueryService) { t.Log("testBeginPanics") testPanicHelper(t, f, "Begin", func(ctx context.Context) error { _, err := conn.Begin(ctx, TestTarget) return err }) }
func testBeginPanics(t *testing.T, conn tabletconn.TabletConn) { t.Log("testBeginPanics") ctx := context.Background() if _, err := conn.Begin(ctx); err == nil || !strings.Contains(err.Error(), "caught test panic") { t.Fatalf("unexpected panic error: %v", err) } }
func testBeginError(t *testing.T, conn tabletconn.TabletConn, f *FakeQueryService) { t.Log("testBeginError") f.HasBeginError = true testErrorHelper(t, f, "Begin", func(ctx context.Context) error { _, err := conn.Begin(ctx, TestTarget) return err }) f.HasBeginError = false }
func testBegin(t *testing.T, conn tabletconn.TabletConn) { ctx := context.Background() transactionID, err := conn.Begin(ctx) if err != nil { t.Fatalf("Begin failed: %v", err) } if transactionID != beginTransactionID { t.Errorf("Unexpected result from Begin: got %v wanted %v", transactionID, beginTransactionID) } }
func testBeginError(t *testing.T, conn tabletconn.TabletConn) { t.Log("testBeginError") ctx := context.Background() _, err := conn.Begin(ctx) if err == nil { t.Fatalf("Begin was expecting an error, didn't get one") } if !strings.Contains(err.Error(), expectedErrMatch) { t.Errorf("Unexpected error from Begin: got %v, wanted err containing %v", err, expectedErrMatch) } }
func testBegin(t *testing.T, conn tabletconn.TabletConn, f *FakeQueryService) { t.Log("testBegin") ctx := context.Background() ctx = callerid.NewContext(ctx, TestCallerID, TestVTGateCallerID) transactionID, err := conn.Begin(ctx, TestTarget) if err != nil { t.Fatalf("Begin failed: %v", err) } if transactionID != BeginTransactionID { t.Errorf("Unexpected result from Begin: got %v wanted %v", transactionID, BeginTransactionID) } }
func testBeginError(t *testing.T, conn tabletconn.TabletConn) { t.Log("testBeginError") ctx := context.Background() _, err := conn.Begin(ctx) verifyError(t, err, "Begin") }