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

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

commit 3747331d05b4372ed57696941a19d6f41cd7670d
Author: Chun-Hung Hsiao <chhs...@mesosphere.io>
AuthorDate: Wed May 15 16:13:19 2019 -0700

    Removed the `TaskStatusUpdateIsTerminalState` matcher.
    
    The `TaskStatusUpdateIsTerminalState` test matcher does not handle both
    v0 and v1 status updates. Since introducing such a matcher in the
    `v1::scheduler` namespace is inconsistent and it is not hard to use the
    built-in `Truly` matcher to implement the same functionality, this
    matcher is removed for now.
    
    Review: https://reviews.apache.org/r/70685
---
 src/tests/containerizer/nvidia_gpu_isolator_tests.cpp | 17 ++++++++++++++---
 src/tests/mesos.hpp                                   | 10 ----------
 2 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/src/tests/containerizer/nvidia_gpu_isolator_tests.cpp 
b/src/tests/containerizer/nvidia_gpu_isolator_tests.cpp
index 5e753e7..fe82c82 100644
--- a/src/tests/containerizer/nvidia_gpu_isolator_tests.cpp
+++ b/src/tests/containerizer/nvidia_gpu_isolator_tests.cpp
@@ -32,6 +32,8 @@
 #include <stout/jsonify.hpp>
 #include <stout/os/exists.hpp>
 
+#include "common/protobuf_utils.hpp"
+
 #include "docker/docker.hpp"
 
 #include "master/master.hpp"
@@ -73,6 +75,7 @@ using testing::AtMost;
 using testing::DoAll;
 using testing::Eq;
 using testing::Return;
+using testing::Truly;
 
 namespace mesos {
 namespace internal {
@@ -307,7 +310,9 @@ TEST_F(NvidiaGpuTest, 
ROOT_INTERNET_CURL_CGROUPS_NVIDIA_GPU_NvidiaDockerImage)
   Future<v1::scheduler::Event::Update> task1Finished;
   EXPECT_CALL(*scheduler, update(_, AllOf(
       TaskStatusUpdateTaskIdEq(task1.task_id()),
-      TaskStatusUpdateIsTerminalState())))
+      Truly([](const v1::scheduler::Event::Update& update) {
+        return protobuf::isTerminalState(devolve(update.status()).state());
+      }))))
     .WillOnce(DoAll(
         FutureArg<1>(&task1Finished),
         v1::scheduler::SendAcknowledge(frameworkId, agentId)));
@@ -315,7 +320,9 @@ TEST_F(NvidiaGpuTest, 
ROOT_INTERNET_CURL_CGROUPS_NVIDIA_GPU_NvidiaDockerImage)
   Future<v1::scheduler::Event::Update> task2Failed;
   EXPECT_CALL(*scheduler, update(_, AllOf(
       TaskStatusUpdateTaskIdEq(task2.task_id()),
-      TaskStatusUpdateIsTerminalState())))
+      Truly([](const v1::scheduler::Event::Update& update) {
+        return protobuf::isTerminalState(devolve(update.status()).state());
+      }))))
     .WillOnce(DoAll(
         FutureArg<1>(&task2Failed),
         v1::scheduler::SendAcknowledge(frameworkId, agentId)));
@@ -429,7 +436,11 @@ TEST_F(NvidiaGpuTest, 
ROOT_INTERNET_CURL_CGROUPS_NVIDIA_GPU_TensorflowGpuImage)
     .WillOnce(v1::scheduler::SendAcknowledge(frameworkId, agentId));
 
   Future<v1::scheduler::Event::Update> terminalStatusUpdate;
-  EXPECT_CALL(*scheduler, update(_, TaskStatusUpdateIsTerminalState()))
+  EXPECT_CALL(*scheduler, update(
+      _,
+      Truly([](const v1::scheduler::Event::Update& update) {
+        return protobuf::isTerminalState(devolve(update.status()).state());
+      })))
     .WillOnce(DoAll(
         FutureArg<1>(&terminalStatusUpdate),
         v1::scheduler::SendAcknowledge(frameworkId, agentId)));
diff --git a/src/tests/mesos.hpp b/src/tests/mesos.hpp
index 605a69f..c886789 100644
--- a/src/tests/mesos.hpp
+++ b/src/tests/mesos.hpp
@@ -73,8 +73,6 @@
 #include "common/http.hpp"
 #include "common/protobuf_utils.hpp"
 
-#include "internal/devolve.hpp"
-
 #include "messages/messages.hpp" // For google::protobuf::Message.
 
 #include "master/master.hpp"
@@ -3697,14 +3695,6 @@ MATCHER_P(TaskStatusUpdateStateEq, taskState, "")
 }
 
 
-// This matcher is used to match an `Event.update.status` message whose state 
is
-// terminal.
-MATCHER(TaskStatusUpdateIsTerminalState, "")
-{
-  return protobuf::isTerminalState(devolve(arg.status()).state());
-}
-
-
 // This matcher is used to match the task id of
 // `authorization::Request.Object.TaskInfo`.
 MATCHER_P(AuthorizationRequestHasTaskID, taskId, "")

Reply via email to