Exemple #1
0
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
	})
}
Exemple #2
0
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)
	}
}
Exemple #3
0
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
}
Exemple #4
0
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)
	}
}
Exemple #5
0
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)
	}
}
Exemple #6
0
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)
	}
}
Exemple #7
0
func testBeginError(t *testing.T, conn tabletconn.TabletConn) {
	t.Log("testBeginError")
	ctx := context.Background()
	_, err := conn.Begin(ctx)
	verifyError(t, err, "Begin")
}