Skip to content

Commit 681f2ae

Browse files
committed
chore: proper error checks
1 parent add1241 commit 681f2ae

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

v2/pkg/engine/datasource/grpc_datasource/execution_plan_composite_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -608,16 +608,16 @@ func TestCompositeTypeExecutionPlan(t *testing.T) {
608608
mapping: testMapping(),
609609
})
610610

611-
rpcPlanVisitor.PlanOperation(&queryDoc, &schemaDoc)
611+
plan, err := rpcPlanVisitor.PlanOperation(&queryDoc, &schemaDoc)
612612

613-
if report.HasErrors() {
613+
if err != nil {
614614
require.NotEmpty(t, tt.expectedError)
615-
require.Contains(t, report.Error(), tt.expectedError)
615+
require.Contains(t, err.Error(), tt.expectedError)
616616
return
617617
}
618618

619619
require.Empty(t, tt.expectedError)
620-
diff := cmp.Diff(tt.expectedPlan, rpcPlanVisitor.plan)
620+
diff := cmp.Diff(tt.expectedPlan, plan)
621621
if diff != "" {
622622
t.Fatalf("execution plan mismatch: %s", diff)
623623
}
@@ -873,16 +873,16 @@ func TestMutationUnionExecutionPlan(t *testing.T) {
873873
mapping: testMapping(),
874874
})
875875

876-
rpcPlanVisitor.PlanOperation(&queryDoc, &schemaDoc)
876+
plan, err := rpcPlanVisitor.PlanOperation(&queryDoc, &schemaDoc)
877877

878-
if report.HasErrors() {
878+
if err != nil {
879879
require.NotEmpty(t, tt.expectedError)
880-
require.Contains(t, report.Error(), tt.expectedError)
880+
require.Contains(t, err.Error(), tt.expectedError)
881881
return
882882
}
883883

884884
require.Empty(t, tt.expectedError)
885-
diff := cmp.Diff(tt.expectedPlan, rpcPlanVisitor.plan)
885+
diff := cmp.Diff(tt.expectedPlan, plan)
886886
if diff != "" {
887887
t.Fatalf("execution plan mismatch: %s", diff)
888888
}

v2/pkg/engine/datasource/grpc_datasource/execution_plan_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,16 @@ func runTest(t *testing.T, testCase testCase) {
3434
mapping: testMapping(),
3535
})
3636

37-
rpcPlanVisitor.PlanOperation(&queryDoc, &schemaDoc)
37+
plan, err := rpcPlanVisitor.PlanOperation(&queryDoc, &schemaDoc)
3838

39-
if report.HasErrors() {
40-
require.NotEmpty(t, testCase.expectedError, "expected error to be empty, got: %s", report.Error())
41-
require.Contains(t, report.Error(), testCase.expectedError, "expected error to contain: %s, got: %s", testCase.expectedError, report.Error())
39+
if err != nil {
40+
require.NotEmpty(t, testCase.expectedError, "expected error to be empty, got: %s", err.Error())
41+
require.Contains(t, err.Error(), testCase.expectedError, "expected error to contain: %s, got: %s", testCase.expectedError, err.Error())
4242
return
4343
}
4444

4545
require.Empty(t, testCase.expectedError)
46-
diff := cmp.Diff(testCase.expectedPlan, rpcPlanVisitor.plan)
46+
diff := cmp.Diff(testCase.expectedPlan, plan)
4747
if diff != "" {
4848
t.Fatalf("execution plan mismatch: %s", diff)
4949
}

0 commit comments

Comments
 (0)