Fix flaky scala test (#5671)

* Fix flaky scala test

* enforce ordering
This commit is contained in:
Lauri Tulmin 2022-03-23 18:57:28 +02:00 committed by GitHub
parent 875b7fe3ad
commit 990dad8640
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 7 deletions

View File

@ -146,10 +146,6 @@ class ScalaInstrumentationTest {
try {
val keptPromise = Promise[Boolean]()
val brokenPromise = Promise[Boolean]()
val afterPromise = keptPromise.future
val afterPromise2 = keptPromise.future
val failedAfterPromise = brokenPromise.future
Future {
tracedChild("future1")
@ -157,16 +153,16 @@ class ScalaInstrumentationTest {
brokenPromise.failure(new IllegalStateException())
}
afterPromise.onSuccess { case _ =>
val afterPromise: Future[Unit] = keptPromise.future.map { _ =>
tracedChild("keptPromise")
}
Await.result(afterPromise, 10.seconds)
afterPromise2.onSuccess { case _ =>
val afterPromise2: Future[Unit] = keptPromise.future.map { _ =>
tracedChild("keptPromise2")
}
Await.result(afterPromise2, 10.seconds)
failedAfterPromise.onFailure { case _ =>
val failedAfterPromise = brokenPromise.future andThen { case _ =>
tracedChild("brokenPromise")
}
assertThatThrownBy(new ThrowingCallable {