sven-lange-last commented on a change in pull request #2878: Streamingly read
user-logs.
URL:
https://github.com/apache/incubator-openwhisk/pull/2878#discussion_r152977447
##########
File path:
tests/src/test/scala/whisk/core/containerpool/test/ContainerProxyTests.scala
##########
@@ -375,7 +385,64 @@ class ContainerProxyTests
collector.calls should have size 1
container.destroyCount shouldBe 1
acker.calls(0)._2.response shouldBe
ActivationResponse.applicationError("boom")
- store.verify(message.transid, *).repeat(1)
+ store.calls should have size 1
+ }
+ }
+
+ it should "complete the transaction and destroy the container if log reading
failed" in {
+ val container = new TestContainer
+ val factory = createFactory(Future.successful(container))
+ val acker = createAcker
+ val store = createStore
+
+ val partialLogs = Vector("this log line made it", Messages.logFailure)
+ val collector =
+
createCollector(Future.failed(LogCollectingException(ActivationLogs(partialLogs))))
+
+ val machine =
+ childActorOf(ContainerProxy.props(factory, acker, store, collector,
InstanceId(0), pauseGrace = timeout))
+ registerCallback(machine)
+ machine ! Run(action, message)
+ expectMsg(Transition(machine, Uninitialized, Running))
+ expectMsg(ContainerRemoved) // The message is sent as soon as the
container decides to destroy itself
+ expectMsg(Transition(machine, Running, Removing))
+
+ awaitAssert {
+ factory.calls should have size 1
+ container.initializeCount shouldBe 1
+ container.runCount shouldBe 1
+ collector.calls should have size 1
+ container.destroyCount shouldBe 1
+ acker.calls(0)._2.response shouldBe ActivationResponse.success()
+ store.calls should have size 1
+ store.calls(0)._2.logs shouldBe ActivationLogs(partialLogs)
+ }
+ }
+
+ it should "complete the transaction and destroy the container if log reading
failed terminally" in {
+ val container = new TestContainer
+ val factory = createFactory(Future.successful(container))
+ val acker = createAcker
+ val store = createStore
+ val collector = createCollector(Future.failed(new Exception))
+
+ val machine =
+ childActorOf(ContainerProxy.props(factory, acker, store, collector,
InstanceId(0), pauseGrace = timeout))
+ registerCallback(machine)
+ machine ! Run(action, message)
+ expectMsg(Transition(machine, Uninitialized, Running))
+ expectMsg(ContainerRemoved) // The message is sent as soon as the
container decides to destroy itself
+ expectMsg(Transition(machine, Running, Removing))
+
+ awaitAssert {
+ factory.calls should have size 1
+ container.initializeCount shouldBe 1
+ container.runCount shouldBe 1
+ collector.calls should have size 1
+ container.destroyCount shouldBe 1
+ acker.calls(0)._2.response shouldBe ActivationResponse.success()
Review comment:
`acker.calls should have size 1`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services