This is an automated email from the ASF dual-hosted git repository. asekretenko pushed a commit to branch 1.7.x in repository https://gitbox.apache.org/repos/asf/mesos.git
commit f1008ce5bc0105d00e9061efc61a9fc5f61a289d 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 bd165ba..dc0e7e9 100644 --- a/src/tests/containerizer/provisioner_docker_tests.cpp +++ b/src/tests/containerizer/provisioner_docker_tests.cpp @@ -330,6 +330,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; @@ -380,6 +383,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()); @@ -390,6 +396,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);