Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v1] Fix try-catch for conformance tests expecting an error #1542

Merged
merged 1 commit into from
Aug 9, 2024

Conversation

alancai98
Copy link
Member

@alancai98 alancai98 commented Aug 7, 2024

Relevant Issues

  • None

Description

  • Seems like the conformance test runner was not reporting back test failures that expected an EvaluationFail but did not error

Other Information

License Information

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link

github-actions bot commented Aug 7, 2024

Conformance comparison report-Cross Engine

Base (legacy) eval +/-
% Passing 90.72% 96.02% 5.30%
✅ Passing 5329 5641 312
❌ Failing 545 234 -311
🔶 Ignored 0 0 0
Total Tests 5874 5875 1
Number passing in both: 5173

Number failing in both: 77

Number passing in legacy engine but fail in eval engine: 157

Number failing in legacy engine but pass in eval engine: 468
⁉️ CONFORMANCE REPORT REGRESSION DETECTED ⁉️
The complete list can be found in GitHub CI summary, either from Step Summary or in the Artifact.
468 test(s) were failing in legacy but now pass in eval. Before merging, confirm they are intended to pass.
The complete list can be found in GitHub CI summary, either from Step Summary or in the Artifact.

Conformance comparison report-Cross Commit-LEGACY

Base (e21a1eb) 361f875 +/-
% Passing 92.46% 90.72% -1.74%
✅ Passing 5431 5329 -102
❌ Failing 443 545 102
🔶 Ignored 0 0 0
Total Tests 5874 5874 0
Number passing in both: 5327

Number failing in both: 441

Number passing in Base (e21a1eb) but now fail: 104

Number failing in Base (e21a1eb) but now pass: 2
⁉️ CONFORMANCE REPORT REGRESSION DETECTED ⁉️
The complete list can be found in GitHub CI summary, either from Step Summary or in the Artifact.
The following test(s) were previously failing but now pass. Before merging, confirm they are intended to pass:

Click here to see
  • MYSQL_SELECT_23, compileOption: PERMISSIVE

  • MYSQL_SELECT_23, compileOption: LEGACY

Conformance comparison report-Cross Commit-EVAL

Base (e21a1eb) 361f875 +/-
% Passing 97.26% 96.02% -1.24%
✅ Passing 5714 5641 -73
❌ Failing 161 234 73
🔶 Ignored 0 0 0
Total Tests 5875 5875 0
Number passing in both: 5641

Number failing in both: 161

Number passing in Base (e21a1eb) but now fail: 74

Number failing in Base (e21a1eb) but now pass: 1
⁉️ CONFORMANCE REPORT REGRESSION DETECTED ⁉️
The complete list can be found in GitHub CI summary, either from Step Summary or in the Artifact.
The following test(s) were previously failing but now pass. Before merging, confirm they are intended to pass:

Click here to see
  • Example 6 — Value Coercion, compileOption: LEGACY

@alancai98 alancai98 requested a review from johnedquinn August 7, 2024 22:53
@alancai98 alancai98 self-assigned this Aug 7, 2024
@alancai98 alancai98 changed the title Fix try-catch for conformance tests expecting an error [v1] Fix try-catch for conformance tests expecting an error Aug 7, 2024
@alancai98 alancai98 marked this pull request as ready for review August 7, 2024 22:54
@alancai98
Copy link
Member Author

alancai98 commented Aug 7, 2024

Some additional test failures due to this change -- https://github.com/partiql/partiql-lang-kotlin/actions/runs/10292632996.

Some of these errors are properly caught by the planner but not detected by the evaluator. Regarding the planner errors, we should probably throw/error on these cases -- #1543.

Copy link
Member

@johnedquinn johnedquinn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR makes me think, why are we even catching these exceptions? Using exceptions for business logic is generally advised against. IMO, this whole method can be simplified by creating the statement/actual variables in each assertion block. Then, we can use a try-catch just for the Assertion.EvaluationFailure where it's required.

Though, it would also be nice to have each variant of TestCase implement their own assertion logic.

@@ -36,14 +38,16 @@ class TestRunner<T, V>(private val factory: TestExecutor.Factory<T, V>) {
val expect = executor.fromIon(assertion.expectedResult)
if (!executor.compare(actual, expect)) {
val ion = executor.toIon(actual)
error("Expected: ${assertion.expectedResult}\nActual: $ion\nMode: ${case.compileOptions.typingMode}")
throw TestRunnerException("Expected error to be thrown but none was thrown.\n${case.name}\nActual result: $ion")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error message isn't the intention behind Assertion.EvaluationSuccess.

@alancai98
Copy link
Member Author

This PR makes me think, why are we even catching these exceptions? Using exceptions for business logic is generally advised against. IMO, this whole method can be simplified by creating the statement/actual variables in each assertion block. Then, we can use a try-catch just for the Assertion.EvaluationFailure where it's required.
Though, it would also be nice to have each variant of TestCase implement their own assertion logic.

Yeah the current TestRunner is somewhat confusing. This PR was initially meant to unblock some testing as part of #1542, but I'll take another look at refactoring the current TestRunner.

@alancai98 alancai98 marked this pull request as draft August 9, 2024 00:04
Copy link
Member

@johnedquinn johnedquinn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed offline -- to unblock Alan's work on the bag ops, I'm approving this PR. A follow-up will ensue.

@johnedquinn johnedquinn marked this pull request as ready for review August 9, 2024 19:36
@johnedquinn johnedquinn merged commit 8717275 into v1 Aug 9, 2024
14 checks passed
@alancai98 alancai98 deleted the fix-conformance-runner branch August 9, 2024 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants