You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by bd...@apache.org on 2023/02/16 20:01:04 UTC

[openwhisk] branch master updated: fix flaky ActivationClientProxy unit test (#5382)

This is an automated email from the ASF dual-hosted git repository.

bdoyle pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwhisk.git


The following commit(s) were added to refs/heads/master by this push:
     new ed43b4d1c fix flaky ActivationClientProxy unit test (#5382)
ed43b4d1c is described below

commit ed43b4d1ce0e6ae27c9a4b714be123be5a82fae9
Author: Brendan Doyle <bd...@gmail.com>
AuthorDate: Thu Feb 16 12:00:56 2023 -0800

    fix flaky ActivationClientProxy unit test (#5382)
    
    Co-authored-by: Brendan Doyle <br...@qualtrics.com>
---
 .../v2/test/ActivationClientProxyTests.scala       | 30 ++++++++++++++--------
 1 file changed, 19 insertions(+), 11 deletions(-)

diff --git a/tests/src/test/scala/org/apache/openwhisk/core/containerpool/v2/test/ActivationClientProxyTests.scala b/tests/src/test/scala/org/apache/openwhisk/core/containerpool/v2/test/ActivationClientProxyTests.scala
index cf8ef15b2..3b29ba2ab 100644
--- a/tests/src/test/scala/org/apache/openwhisk/core/containerpool/v2/test/ActivationClientProxyTests.scala
+++ b/tests/src/test/scala/org/apache/openwhisk/core/containerpool/v2/test/ActivationClientProxyTests.scala
@@ -203,26 +203,34 @@ class ActivationClientProxyTests
     val client = (_: String, _: FullyQualifiedEntityName, _: String, _: Int, _: Boolean) =>
       Future(MockActivationServiceClient(fetch))
 
-    val probe = TestProbe()
+    val parentProbe = TestProbe()
+    val selfProbe = TestProbe()
     val machine =
-      probe.childActorOf(
+      parentProbe.childActorOf(
         ActivationClientProxy
           .props(invocationNamespace.asString, fqn, rev, schedulerHost, rpcPort, containerId, client))
-    registerCallback(machine, probe)
-    ready(machine, probe)
+
+    // set up watch of client proxy fsm
+    machine ! SubscribeTransitionCallBack(selfProbe.ref)
+    selfProbe.expectMsg(CurrentState(machine, ClientProxyUninitialized))
+    selfProbe watch machine
+
+    // wait for client proxy to be ready
+    machine ! StartClient
+    parentProbe.expectMsg(ClientCreationCompleted)
+    selfProbe.expectMsg(Transition(machine, ClientProxyUninitialized, ClientProxyReady))
 
     machine ! RequestActivation()
 
-    inAnyOrder {
-      probe.expectMsg(Transition(machine, ClientProxyReady, ClientProxyRemoving))
-      probe.expectMsgPF() {
-        case Failure(t) => t.getMessage.contains(s"action version does not match") shouldBe true
-      }
+    // next two events can happen in any order
+    selfProbe.expectMsg(Transition(machine, ClientProxyReady, ClientProxyRemoving))
+    parentProbe.expectMsgPF() {
+      case Failure(t) => t.getMessage.contains(s"action version does not match") shouldBe true
     }
 
-    probe.expectMsg(ClientClosed)
+    parentProbe.expectMsg(ClientClosed)
 
-    probe expectTerminated machine
+    selfProbe expectTerminated machine
   }
 
   it should "retry to request activation message when scheduler response no activation message" in within(timeout) {