enso/lib/scala
Hubert Plociniczak 31a0dcef65
Suppress logs for test cases unless a failure is reported (#8694)
The change adds a convenient trait `ReportLogsOnFailure` that, when merged with the test class, will keep logs in memory and only delegate to the underlying appender on failure. For now we only support forwarding to the console which is sufficient.
A corresponding entry in `application-test.conf` has to point to the new `memory` appender. The additional complexity in the implementation ensures that if someone forgets to mixin `ReportLogsOnFailure` logs appear as before i.e. they respect the log level.

As a bonus fixed arguments passed to ScalaTest in build.sbt so that we are now, again, showing timings of individual tests.

Closes #8603.

# Important Notes
Before:
```
[info] VcsManagerTest:
[info] Initializing project
[ERROR] [2024-01-04 17:27:03,366] [org.enso.languageserver.search.SuggestionsHandler] Cannot read the package definition from [/tmp/3607843843826594318].
[info] - must create a repository (3 seconds, 538 milliseconds)
[info] - must fail to create a repository for an already existing project (141 milliseconds)
[info] Save project
[ERROR] [2024-01-04 17:27:08,346] [org.enso.languageserver.search.SuggestionsHandler] Cannot read the package definition from [/tmp/3607843843826594318].
[info] - must create a commit with a timestamp (198 milliseconds)
[ERROR] [2024-01-04 17:27:08,570] [org.enso.languageserver.search.SuggestionsHandler] Cannot read the package definition from [/tmp/3607843843826594318].
[info] - must create a commit with a name (148 milliseconds)
[ERROR] [2024-01-04 17:27:08,741] [org.enso.languageserver.search.SuggestionsHandler] Cannot read the package definition from [/tmp/3607843843826594318].
[info] - must force all pending saves (149 milliseconds)
[info] Status project
[ERROR] [2024-01-04 17:27:08,910] [org.enso.languageserver.search.SuggestionsHandler] Cannot read the package definition from [/tmp/3607843843826594318].
[info] - must report changed files since last commit (148 milliseconds)
[info] Restore project
[ERROR] [2024-01-04 17:27:09,076] [org.enso.languageserver.search.SuggestionsHandler] Cannot read the package definition from [/tmp/3607843843826594318].
[info] - must reset to the last state with committed changes (236 milliseconds)
[ERROR] [2024-01-04 17:27:09,328] [org.enso.languageserver.search.SuggestionsHandler] Cannot read the package definition from [/tmp/3607843843826594318].
[info] - must reset to a named save (pending)
[ERROR] [2024-01-04 17:27:09,520] [org.enso.languageserver.search.SuggestionsHandler] Cannot read the package definition from [/tmp/3607843843826594318].
[info] - must reset to a named save and notify about removed files *** FAILED *** (185 milliseconds)
[info]   Right({
[info]     "jsonrpc" : "2.0",
[info]     "method" : "file/event",
[info]     "params" : {
[info]       "path" : {
[info]         "rootId" : "cd84a4a3-fa50-4ead-8d80-04f6d0d124a3",
[info]         "segments" : [
[info]           "src",
[info]           "Bar.enso"
[info]         ]
[info]       },
[info]       "kind" : "Removed"
[info]     }
[info]   }) did not equal Right({
[info]     "jsonrpc" : "1.0",
[info]     "method" : "file/event",
[info]     "params" : {
[info]       "path" : {
[info]         "rootId" : "cd84a4a3-fa50-4ead-8d80-04f6d0d124a3",
[info]         "segments" : [
[info]           "src",
[info]           "Bar.enso"
[info]         ]
[info]       },
[info]       "kind" : "Removed"
[info]     }
[info]   }) (VcsManagerTest.scala:1343)
[info]   Analysis:
[info]   Right(value: Json$JObject(value: object[jsonrpc -> "2.0",method -> "file/event",params -> {
[info]   "path" : {
[info]     "rootId" : "cd84a4a3-fa50-4ead-8d80-04f6d0d124a3",
[info]     "segments" : [
[info]       "src",
[info]       "Bar.enso"
[info]     ]
[info]   },
[info]   "kind" : "Removed"
[info] }] -> object[jsonrpc -> "1.0",method -> "file/event",params -> {
[info]   "path" : {
[info]     "rootId" : "cd84a4a3-fa50-4ead-8d80-04f6d0d124a3",
[info]     "segments" : [
[info]       "src",
[info]       "Bar.enso"
[info]     ]
[info]   },
[info]   "kind" : "Removed"
[info] }]))
[ERROR] [2024-01-04 17:27:09,734] [org.enso.languageserver.search.SuggestionsHandler] Cannot read the package definition from [/tmp/3607843843826594318].
[info] List project saves
[info] - must return all explicit commits (146 milliseconds)
[info] Run completed in 9 seconds, 270 milliseconds.
[info] Total number of tests run: 9
[info] Suites: completed 1, aborted 0
[info] Tests: succeeded 8, failed 1, canceled 0, ignored 0, pending 1
[info] *** 1 TEST FAILED ***
```

After:
```
[info] VcsManagerTest:
[info] Initializing project
[info] - must create a repository (3 seconds, 554 milliseconds)
[info] - must fail to create a repository for an already existing project (164 milliseconds)
[info] Save project
[info] - must create a commit with a timestamp (212 milliseconds)
[info] - must create a commit with a name (142 milliseconds)
[info] - must force all pending saves (185 milliseconds)
[info] Status project
[info] - must report changed files since last commit (142 milliseconds)
[info] Restore project
[info] - must reset to the last state with committed changes (202 milliseconds)
[info] - must reset to a named save (pending)
[ERROR] [2024-01-04 17:24:55,738] [org.enso.languageserver.search.SuggestionsHandler] Cannot read the package definition from [/tmp/8456553964637757156].
[info] - must reset to a named save and notify about removed files *** FAILED *** (186 milliseconds)
[info]   Right({
[info]     "jsonrpc" : "2.0",
[info]     "method" : "file/event",
[info]     "params" : {
[info]       "path" : {
[info]         "rootId" : "965ed5c8-1760-4284-91f2-1376406fde0d",
[info]         "segments" : [
[info]           "src",
[info]           "Bar.enso"
[info]         ]
[info]       },
[info]       "kind" : "Removed"
[info]     }
[info]   }) did not equal Right({
[info]     "jsonrpc" : "1.0",
[info]     "method" : "file/event",
[info]     "params" : {
[info]       "path" : {
[info]         "rootId" : "965ed5c8-1760-4284-91f2-1376406fde0d",
[info]         "segments" : [
[info]           "src",
[info]           "Bar.enso"
[info]         ]
[info]       },
[info]       "kind" : "Removed"
[info]     }
[info]   }) (VcsManagerTest.scala:1343)
[info]   Analysis:
[info]   Right(value: Json$JObject(value: object[jsonrpc -> "2.0",method -> "file/event",params -> {
[info]   "path" : {
[info]     "rootId" : "965ed5c8-1760-4284-91f2-1376406fde0d",
[info]     "segments" : [
[info]       "src",
[info]       "Bar.enso"
[info]     ]
[info]   },
[info]   "kind" : "Removed"
[info] }] -> object[jsonrpc -> "1.0",method -> "file/event",params -> {
[info]   "path" : {
[info]     "rootId" : "965ed5c8-1760-4284-91f2-1376406fde0d",
[info]     "segments" : [
[info]       "src",
[info]       "Bar.enso"
[info]     ]
[info]   },
[info]   "kind" : "Removed"
[info] }]))
[info] List project saves
[info] - must return all explicit commits (131 milliseconds)
[info] Run completed in 9 seconds, 400 milliseconds.
[info] Total number of tests run: 9
[info] Suites: completed 1, aborted 0
[info] Tests: succeeded 8, failed 1, canceled 0, ignored 0, pending 1
[info] *** 1 TEST FAILED ***
```
2024-01-09 09:59:10 +00:00
..
akka-native/src/main enso4igv can open engine/language-server & co. projects (#4098) 2023-01-31 08:40:04 +00:00
bench-processor/src Update java formatter sbt plugin (#8543) 2023-12-15 14:45:23 +00:00
cli/src Build distribution for amd64 and aarch64 MacOS (#8407) 2023-12-05 11:24:02 +01:00
common-polyglot-core-utils/src/main/java/org/enso/polyglot/common_utils Update java formatter sbt plugin (#8543) 2023-12-15 14:45:23 +00:00
connected-lock-manager/src Fix initialization race-condition in runtime connector (#7985) 2023-10-13 10:03:27 +00:00
distribution-manager/src/main Cleanup after each test run (#8418) 2023-11-29 19:02:59 +00:00
downloader/src enso4igv can open engine/language-server & co. projects (#4098) 2023-01-31 08:40:04 +00:00
edition-updater/src Reduce extra output in compilation and tests (#7809) 2023-10-16 10:57:44 +02:00
edition-uploader/src/main enso4igv can open engine/language-server & co. projects (#4098) 2023-01-31 08:40:04 +00:00
editions/src Cats are not welcome (#8696) 2024-01-07 21:03:14 +00:00
filewatcher/src All unit tests use the same testing logging provider (#8593) 2023-12-21 13:45:33 +00:00
interpreter-dsl/src/main/java/org/enso/interpreter/dsl Update java formatter sbt plugin (#8543) 2023-12-15 14:45:23 +00:00
json-rpc-server Add support for https and wss (#7937) 2023-10-12 00:03:34 +02:00
json-rpc-server-test Report failures when upserting visualizations (#8306) 2023-11-20 11:38:51 +00:00
library-manager/src Change layout of local library search path in order to be able to move Round_Spec.enso back to Tests (#7634) 2023-09-01 20:20:04 +00:00
library-manager-test/src All unit tests use the same testing logging provider (#8593) 2023-12-21 13:45:33 +00:00
locking-test-helper/src/main enso4igv can open engine/language-server & co. projects (#4098) 2023-01-31 08:40:04 +00:00
logging-config/src/main/java/org/enso/logger Suppress logs for test cases unless a failure is reported (#8694) 2024-01-09 09:59:10 +00:00
logging-service/src/main/java/org/enso/logging Let logging to file respect log level (#8264) 2023-11-14 11:59:27 +00:00
logging-service-logback/src Suppress logs for test cases unless a failure is reported (#8694) 2024-01-09 09:59:10 +00:00
logging-truffle-connector/src/main Reduce extra output in compilation and tests (#7809) 2023-10-16 10:57:44 +02:00
logging-utils/src Update java formatter sbt plugin (#8543) 2023-12-15 14:45:23 +00:00
logging-utils-akka/src/main Replace a custom logger with off the shelf implementation (#7559) 2023-09-04 09:40:16 +00:00
pkg Do not change project module name to Upper_Snake_Case (#8697) 2024-01-08 16:26:35 +00:00
profiling-utils/src On-deman backend heap and thread dump (#8320) 2023-11-20 11:41:01 +00:00
project-manager Suppress logs for test cases unless a failure is reported (#8694) 2024-01-09 09:59:10 +00:00
refactoring-utils/src Speeding up "hello world" example by 16% 2023-11-19 16:38:31 +01:00
runtime-version-manager/src project-manager can start without prior GraalVM installation (#8410) 2023-11-29 20:36:21 +01:00
runtime-version-manager-test/src All unit tests use the same testing logging provider (#8593) 2023-12-21 13:45:33 +00:00
searcher/src Upgrade enso to GraalVM for jdk 21 (#7991) 2023-11-17 18:02:36 +00:00
syntax Speeding up "hello world" example by 16% 2023-11-19 16:38:31 +01:00
task-progress-notifications/src/main/scala/org/enso/cli/task/notifications Scala 2.13.11 and libraries update (#7010) 2023-06-14 13:15:57 +00:00
testkit/src/main Add thread dump info to investigate MacOS timeouts (#8577) 2023-12-19 16:11:44 +00:00
text-buffer/src Remove org.bouncycastle dependency (#8664) 2024-01-04 17:16:41 +01:00
version-output/src/main Log project manager version on startup (#7646) 2023-08-24 16:45:22 +00:00