Skip to content

Commit e725a00

Browse files
authored
Merge 4f84445 into 3ea756f
2 parents 3ea756f + 4f84445 commit e725a00

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

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

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -203,26 +203,34 @@ class ActivationClientProxyTests
203203
val client = (_: String, _: FullyQualifiedEntityName, _: String, _: Int, _: Boolean) =>
204204
Future(MockActivationServiceClient(fetch))
205205

206-
val probe = TestProbe()
206+
val parentProbe = TestProbe()
207+
val selfProbe = TestProbe()
207208
val machine =
208-
probe.childActorOf(
209+
parentProbe.childActorOf(
209210
ActivationClientProxy
210211
.props(invocationNamespace.asString, fqn, rev, schedulerHost, rpcPort, containerId, client))
211-
registerCallback(machine, probe)
212-
ready(machine, probe)
212+
213+
// set up watch of client proxy fsm
214+
machine ! SubscribeTransitionCallBack(selfProbe.ref)
215+
selfProbe.expectMsg(CurrentState(machine, ClientProxyUninitialized))
216+
selfProbe watch machine
217+
218+
// wait for client proxy to be ready
219+
machine ! StartClient
220+
parentProbe.expectMsg(ClientCreationCompleted)
221+
selfProbe.expectMsg(Transition(machine, ClientProxyUninitialized, ClientProxyReady))
213222

214223
machine ! RequestActivation()
215224

216-
inAnyOrder {
217-
probe.expectMsg(Transition(machine, ClientProxyReady, ClientProxyRemoving))
218-
probe.expectMsgPF() {
219-
case Failure(t) => t.getMessage.contains(s"action version does not match") shouldBe true
220-
}
225+
// next two events can happen in any order
226+
selfProbe.expectMsg(Transition(machine, ClientProxyReady, ClientProxyRemoving))
227+
parentProbe.expectMsgPF() {
228+
case Failure(t) => t.getMessage.contains(s"action version does not match") shouldBe true
221229
}
222230

223-
probe.expectMsg(ClientClosed)
231+
parentProbe.expectMsg(ClientClosed)
224232

225-
probe expectTerminated machine
233+
selfProbe expectTerminated machine
226234
}
227235

228236
it should "retry to request activation message when scheduler response no activation message" in within(timeout) {

0 commit comments

Comments
 (0)