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

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

commit 3ee545c4f039000adc80d4bac3550e40616999db
Author: Andrei Sekretenko <asekrete...@apache.org>
AuthorDate: Thu Aug 20 18:16:39 2020 +0200

    Added discarding a future returned by get() into the docker store test.
    
    This patch extends the `PullingSameImageSimultaneously` test
    with discarding one of the futures returned by `store->get()`
    and making sure that the pull still completes.
    
    Review: https://reviews.apache.org/r/72793
---
 src/tests/containerizer/provisioner_docker_tests.cpp | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/tests/containerizer/provisioner_docker_tests.cpp 
b/src/tests/containerizer/provisioner_docker_tests.cpp
index 477a875..5de97e2 100644
--- a/src/tests/containerizer/provisioner_docker_tests.cpp
+++ b/src/tests/containerizer/provisioner_docker_tests.cpp
@@ -335,6 +335,9 @@ public:
 // This tests the store to pull the same image simultaneously.
 // This test verifies that the store only calls the puller once
 // when multiple requests for the same image is in flight.
+// In addition, this test verifies that if some of the futures
+// returned by `Store::get()` that are pending image pull are discarded,
+// the pull still completes.
 TEST_F(ProvisionerDockerLocalStoreTest, PullingSameImageSimultaneously)
 {
   slave::Flags flags;
@@ -385,6 +388,9 @@ TEST_F(ProvisionerDockerLocalStoreTest, 
PullingSameImageSimultaneously)
   Future<slave::ImageInfo> imageInfo2 =
     store.get()->get(mesosImage, COPY_BACKEND);
 
+  Future<slave::ImageInfo> imageInfo3 =
+    store.get()->get(mesosImage, COPY_BACKEND);
+
   Try<spec::ImageReference> reference =
     spec::parseImageReference(mesosImage.docker().name());
 
@@ -395,6 +401,11 @@ TEST_F(ProvisionerDockerLocalStoreTest, 
PullingSameImageSimultaneously)
   result.add_layer_ids("456");
 
   ASSERT_TRUE(imageInfo2.isPending());
+  ASSERT_TRUE(imageInfo3.isPending());
+
+  // Pull should still complete, despite of the discard of a single future.
+  imageInfo3.discard();
+
   promise.set(result);
 
   AWAIT_READY(imageInfo1);

Reply via email to