Created
May 10, 2020 20:18
-
-
Save jchapuis/ed73139e5620ff1dbe59208d3db11425 to your computer and use it in GitHub Desktop.
Markdium-Orchestrating startup and shutdown in Scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"notify stopped with error in case of service stop timeout" in { | |
implicit val scheduler = TestScheduler() | |
val serviceA = Service.withName("A").withStopper(() => Future.never).build | |
val serviceB = Service.withName("B").withStopper(() => Future.successful(())).build | |
Given("a started composite with finite stopped timeout") | |
implicit val stoppedTimeout = FiniteStoppedTimeout(30 seconds) | |
val composite = new CompositeService(serviceA, serviceB) | |
composite.start() | |
scheduler.tick(1 second) | |
When("stopping the composite") | |
composite.triggerStop() | |
Then("composite eventually notifies stopped with errors") | |
scheduler.tick(31 seconds) // this simulates 31 seconds elapsing | |
composite.stopped.futureValue shouldBe left | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment