Skip to content

Commit

Permalink
Fix error reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
vil1 committed May 27, 2024
1 parent 2f16f6e commit 7ef6021
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 10 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,16 @@ jobs:
run: ls -lR ~/.m2/repository/com/databricks/labs

- name: Run Acceptance Tests with Maven
run: mvn -X --update-snapshots -B test -pl acceptance --file pom.xml --fail-at-end
run: mvn --update-snapshots -B test -pl acceptance --file pom.xml --fail-at-end
continue-on-error: true

- name: Publish JUnit report
uses: mikepenz/action-junit-report@v4
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
report_paths: '**/TEST-com.databricks.labs.remorph.acceptance*.xml'
files: |
**/TEST-com.databricks.labs.remorph.acceptance*.xml
comment_title: 'Acceptance tests results'
check_name: 'Acceptance Tests Results'
fail_on: 'nothing'
continue-on-error: true
2 changes: 1 addition & 1 deletion acceptance/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<configuration>
<reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
<junitxml>.</junitxml>
<filereports>W tests-report.xml</filereports>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
<executions>
<execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,23 @@ class IsResolvedAsSnowflakeQueryRunner(override protected val astBuilder: Snowfl
override def makeErrHandler(chars: String): ErrorCollector =
new ProductionErrorCollector(chars, "")
override def runQuery(query: String): Assertion = {
try {
val result = astBuilder.visit(parseString(query, _.snowflake_file()))
assert(!result.toString.contains("Unresolved"), result.toString)
} catch {
case NonFatal(_) =>
fail(errHandler.formatErrors.mkString("\n"))
val result =
try {
astBuilder.visit(parseString(query, _.snowflake_file()))
} catch {
case NonFatal(e) =>
val formattedErrors = errHandler.formatErrors
val msg = if (formattedErrors.nonEmpty) {
formattedErrors.mkString("\n")
} else {
Option(e.getMessage).getOrElse(s"Unexpected exception of class ${e.getClass} was thrown")
}
fail(msg)
}
if (result.toString.contains("Unresolved")) {
fail(s"Translated query contains unresolved bits: $result")
} else {
succeed
}
}

Expand Down

0 comments on commit 7ef6021

Please sign in to comment.