diff --git a/release_notes.md b/release_notes.md index cf9a3d51be..8c31f72f79 100644 --- a/release_notes.md +++ b/release_notes.md @@ -3,7 +3,7 @@ - [#784](https://github.com/Flank/flank/pull/784) Add output-style option. ([jan-gogo](https://github.com/jan-gogo)) - [#779](https://github.com/Flank/flank/pull/779) Print retries & display additional info. ([jan-gogo](https://github.com/jan-gogo)) - [#793](https://github.com/Flank/flank/issues/793) Better error message on file not found. ([adamfilipow92](https://github.com/adamfilipow92)) -- +- [#807](https://github.com/Flank/flank/issues/807) Fix Bugsnag being initialized during tests. ([piotradamczyk5](https://github.com/piotradamczyk5)) - ## v20.05.2 diff --git a/test_runner/src/main/kotlin/ftl/config/FtlConstants.kt b/test_runner/src/main/kotlin/ftl/config/FtlConstants.kt index e03f8bdf64..c28cda6d5c 100644 --- a/test_runner/src/main/kotlin/ftl/config/FtlConstants.kt +++ b/test_runner/src/main/kotlin/ftl/config/FtlConstants.kt @@ -1,5 +1,6 @@ package ftl.config +import com.bugsnag.Bugsnag import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport import com.google.api.client.googleapis.util.Utils import com.google.api.client.http.GoogleApiLogger @@ -54,10 +55,8 @@ object FtlConstants { val JSON_FACTORY: JsonFactory by lazy { Utils.getDefaultJsonFactory() } - val bugsnag = initBugsnag(useMock) - - init { - bugsnag?.setAppVersion(readRevision()) + val bugsnag: Bugsnag? by lazy { + initBugsnag(useMock)?.apply { setAppVersion(readRevision()) } } val httpTransport: NetHttpTransport by lazy { diff --git a/test_runner/src/main/kotlin/ftl/util/Utils.kt b/test_runner/src/main/kotlin/ftl/util/Utils.kt index 50d697aff0..e90c98157e 100644 --- a/test_runner/src/main/kotlin/ftl/util/Utils.kt +++ b/test_runner/src/main/kotlin/ftl/util/Utils.kt @@ -163,11 +163,7 @@ fun withGlobalExceptionHandling(block: () -> Int) { // We need to cover the case where some component in the call stack starts a non-daemon // thread, and then throws an Error that kills the main thread. This is extra safe implementation else -> { - // this is workaround for Bugsnag initialization bug, should be removed when resolved - // https://github.com/Flank/flank/issues/699 - if (FtlConstants.useMock.not()) { - FtlConstants.bugsnag?.notify(t) - } + FtlConstants.bugsnag?.notify(t) t.printStackTrace() exitProcess(3) }