Skip to content

Commit c6e4532

Browse files
committed
Make the test stable
1 parent 07c9202 commit c6e4532

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/v2/ActivationClientProxy.scala

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,9 @@ class ActivationClientProxy(
124124
stay()
125125

126126
case Event(e: RescheduleActivation, client: Client) =>
127-
logging.info(this, s"[${containerId.asString}] got a reschedule message ${e.msg.activationId} for action: ${e.msg.action}")
127+
logging.info(
128+
this,
129+
s"[${containerId.asString}] got a reschedule message ${e.msg.activationId} for action: ${e.msg.action}")
128130
client.activationClient
129131
.rescheduleActivation(
130132
RescheduleRequest(e.invocationNamespace, e.fqn.serialize, e.rev.serialize, e.msg.serialize))
@@ -247,7 +249,9 @@ class ActivationClientProxy(
247249
stay()
248250

249251
case Event(f: FailureMessage, c: Client) =>
250-
logging.error(this, s"[${containerId.asString}] some error happened for action: ${action} in state: $stateName, caused by: $f")
252+
logging.error(
253+
this,
254+
s"[${containerId.asString}] some error happened for action: ${action} in state: $stateName, caused by: $f")
251255
safelyCloseClient(c)
252256
stay()
253257

@@ -281,7 +285,9 @@ class ActivationClientProxy(
281285
goto(ClientProxyRemoving)
282286

283287
case Event(ClientClosed, _) =>
284-
logging.info(this, s"[${containerId.asString}] the underlying client is closed, stopping the activation client proxy")
288+
logging.info(
289+
this,
290+
s"[${containerId.asString}] the underlying client is closed, stopping the activation client proxy")
285291
context.parent ! ClientClosed
286292

287293
stop()

core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/v2/FunctionPullingContainerProxy.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,11 @@ class FunctionPullingContainerProxy(
339339

340340
// wait for container creation when cold start
341341
case Event(ClientCreationCompleted(proxy), _: NonexistentData) =>
342-
self ! ClientCreationCompleted(proxy.orElse(Some(sender())))
342+
akka.pattern.after(3.milliseconds, actorSystem.scheduler) {
343+
self ! ClientCreationCompleted(proxy.orElse(Some(sender())))
344+
Future.successful({})
345+
}
346+
343347
stay()
344348

345349
// client was successfully obtained

tests/src/test/scala/org/apache/openwhisk/core/containerpool/v2/test/FunctionPullingContainerProxyTests.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1576,7 +1576,11 @@ class FunctionPullingContainerProxyTests
15761576
machine ! Initialize(invocationNamespace.asString, fqn, action, schedulerHost, rpcPort, messageTransId)
15771577
probe.expectMsg(Transition(machine, Uninitialized, CreatingClient))
15781578
client.expectMsg(StartClient)
1579-
client.send(machine, ClientCreationCompleted())
1579+
client.send(machine, ClientCreationCompleted(Some(client.ref)))
1580+
1581+
awaitAssert {
1582+
machine.underlyingActor.stateData.getContainer should not be None
1583+
}
15801584

15811585
val containerId = machine.underlyingActor.stateData.getContainer match {
15821586
case Some(container) => container.containerId

0 commit comments

Comments
 (0)