Skip to content

Commit 026b0b9

Browse files
gengliangwangHyukjinKwon
authored andcommitted
[SPARK-32253][INFRA] Show errors only for the sbt tests of github actions
### What changes were proposed in this pull request? Make the test result log of github action more readable by showing errors from SBT only. 1. Add "--error" flag to sbt in github action to set the log level as "ERROR" 2. Show only failed test cases in stderr output of github action. According to https://www.scalatest.org/user_guide/using_the_runner, with SBT option `-eNCXEHLOPQMDF ` we can drop all the following events: ``` N - drop TestStarting events C - drop TestSucceeded events X - drop TestIgnored events E - drop TestPending events H - drop SuiteStarting events L - drop SuiteCompleted events O - drop InfoProvided events P - drop ScopeOpened events Q - drop ScopeClosed events R - drop ScopePending events M - drop MarkupProvided events ``` and enable the following two mode: ``` D - show all durations F - show full stack traces ``` ### Why are the changes needed? Currently, the output of github action is very long and we have to scroll down to find the failed test cases. Even more, the log may be truncated. In such a case, we will have to wait until all the jobs are completed and then download all the raw logs. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Before changes, all the warnings in compiling are shown: ![image](https://user-images.githubusercontent.com/1097932/87846810-98ec8900-c887-11ea-913b-164b84df62cd.png) as well as all the passed and ignored test cases: ![image](https://user-images.githubusercontent.com/1097932/87846834-ca655480-c887-11ea-9c29-977f802e4c82.png) After changes, sbt test only shows the summary for a successful job: ![image](https://user-images.githubusercontent.com/1097932/87846961-e74e5780-c888-11ea-82d5-cf1da1740181.png) ![image](https://user-images.githubusercontent.com/1097932/87745273-5735e280-c7a2-11ea-8ac9-b4b0e3cb458d.png) If there is a test failure, a full stack track is shown as well as a test failure summary at the end of test log: ![image](https://user-images.githubusercontent.com/1097932/87751143-3aa1a680-c7b2-11ea-9d09-52637a322270.png) ![image](https://user-images.githubusercontent.com/1097932/87752404-1f846600-c7b5-11ea-8106-8ddaf3cc3f7e.png) Closes #29133 from gengliangwang/shortLog. Authored-by: Gengliang Wang <[email protected]> Signed-off-by: HyukjinKwon <[email protected]>
1 parent c7a68a9 commit 026b0b9

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

dev/run-tests.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,9 @@ def main():
653653
# If we're running the tests in Github Actions, attempt to detect and test
654654
# only the affected modules.
655655
if test_env == "github_actions":
656+
# Set the log level of sbt as ERROR to make the output more readable.
657+
if build_tool == "sbt":
658+
extra_profiles.append("--error")
656659
if os.environ["GITHUB_BASE_REF"] != "":
657660
# Pull requests
658661
changed_files = identify_changed_files_from_git_commits(

project/SparkBuild.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,6 +1027,13 @@ object TestSettings {
10271027
}.getOrElse(Nil): _*),
10281028
// Show full stack trace and duration in test cases.
10291029
testOptions in Test += Tests.Argument("-oDF"),
1030+
// Show only the failed test cases with full stack traces in github action to make the log more
1031+
// readable.
1032+
// Check https://www.scalatest.org/user_guide/using_the_runner for the details of options .
1033+
testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest,
1034+
sys.env.get("GITHUB_ACTIONS").map { _ =>
1035+
Seq("-eNCXEHLOPQMDF")
1036+
}.getOrElse(Nil): _*),
10301037
testOptions in Test += Tests.Argument(TestFrameworks.JUnit, "-v", "-a"),
10311038
// Required to detect Junit tests for each project, see also https://github.com/sbt/junit-interface/issues/35
10321039
crossPaths := false,

0 commit comments

Comments
 (0)