You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2018/01/24 23:51:37 UTC

[2/3] mesos git commit: Added a test for discarding a future from Queue::get.

Added a test for discarding a future from Queue::get.

Review: https://reviews.apache.org/r/65151


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/2d19d88c
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/2d19d88c
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/2d19d88c

Branch: refs/heads/master
Commit: 2d19d88cbd55efcb5fcf787f56709ea7ae3e786e
Parents: e48e00a
Author: Benjamin Mahler <bm...@apache.org>
Authored: Sat Jan 13 13:32:10 2018 -0800
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Wed Jan 24 15:31:08 2018 -0800

----------------------------------------------------------------------
 3rdparty/libprocess/src/tests/queue_tests.cpp | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/2d19d88c/3rdparty/libprocess/src/tests/queue_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/queue_tests.cpp b/3rdparty/libprocess/src/tests/queue_tests.cpp
index 95b7381..cc6b3d8 100644
--- a/3rdparty/libprocess/src/tests/queue_tests.cpp
+++ b/3rdparty/libprocess/src/tests/queue_tests.cpp
@@ -89,3 +89,24 @@ TEST(QueueTest, Queue)
   EXPECT_EQ("pretty", get2.get());
   EXPECT_EQ("world", get3.get());
 }
+
+
+TEST(QueueTest, Discard)
+{
+  Queue<string> q;
+
+  Future<string> get1 = q.get();
+  Future<string> get2 = q.get();
+
+  EXPECT_TRUE(get1.isPending());
+  EXPECT_TRUE(get2.isPending());
+
+  get1.discard();
+
+  EXPECT_TRUE(get1.isDiscarded());
+
+  q.put("hello");
+
+  EXPECT_TRUE(get2.isReady());
+  EXPECT_EQ("hello", get2.get());
+}