From da6efc939e561b7d0133db614f35f5d147e7b922 Mon Sep 17 00:00:00 2001 From: Andres Taylor Date: Wed, 13 Dec 2023 10:58:34 +0100 Subject: [PATCH] test: fix tests that check error Signed-off-by: Andres Taylor --- .../vtgate/planbuilder/operators/queryprojection_test.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/go/vt/vtgate/planbuilder/operators/queryprojection_test.go b/go/vt/vtgate/planbuilder/operators/queryprojection_test.go index 28b8b0413e3..517b169bcf8 100644 --- a/go/vt/vtgate/planbuilder/operators/queryprojection_test.go +++ b/go/vt/vtgate/planbuilder/operators/queryprojection_test.go @@ -86,7 +86,7 @@ func TestQP(t *testing.T) { _, err = semantics.Analyze(sel, "", &semantics.FakeSI{}) require.NoError(t, err) - qp := createQPFromSelect(ctx, sel) + qp, err := getQPAndError(ctx, sel) if tcase.expErr != "" { require.Error(t, err) require.Contains(t, err.Error(), tcase.expErr) @@ -103,6 +103,12 @@ func TestQP(t *testing.T) { } } +func getQPAndError(ctx *plancontext.PlanningContext, sel *sqlparser.Select) (qp *QueryProjection, err error) { + defer PanicHandler(&err) + qp = createQPFromSelect(ctx, sel) + return +} + func TestQPSimplifiedExpr(t *testing.T) { testCases := []struct { query, expected string