This is an automated email from the ASF dual-hosted git repository. josephwu pushed a commit to branch 1.5.x in repository https://gitbox.apache.org/repos/asf/mesos.git
commit d1a1c89fff47dfabf5d9dd5456d198e9d64a5a13 Author: Andrei Budnik <[email protected]> AuthorDate: Wed Nov 14 11:53:33 2018 -0800 Added `FetcherCacheTest.LocalCachedMissing` test. This test verifies that the fetcher retries downloading URI when the cache file is missing. Review: https://reviews.apache.org/r/69172/ --- src/tests/fetcher_cache_tests.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/tests/fetcher_cache_tests.cpp b/src/tests/fetcher_cache_tests.cpp index 7db7b7d..e05f32e 100644 --- a/src/tests/fetcher_cache_tests.cpp +++ b/src/tests/fetcher_cache_tests.cpp @@ -703,6 +703,45 @@ TEST_F(FetcherCacheTest, LocalCached) } +// This test launches a task with enabled cache, then removes all cached files, +// then attempts to launch another task with the same URIs as the first task. +// We expect that the fetcher retries to download all the artifacts when cached +// files are missing. +TEST_F(FetcherCacheTest, LocalCachedMissing) +{ + startSlave(); + driver->start(); + + for (size_t i = 0; i < 2; i++) { + CommandInfo::URI uri; + uri.set_value(commandPath); + uri.set_executable(true); + uri.set_cache(true); + + CommandInfo commandInfo; + commandInfo.set_value("./" + COMMAND_NAME + " " + taskName(i)); + commandInfo.add_uris()->CopyFrom(uri); + + const Try<Task> task = launchTask(commandInfo, i); + ASSERT_SOME(task); + + AWAIT_READY(awaitFinished(task.get())); + + const string path = path::join(task->runDirectory.string(), COMMAND_NAME); + EXPECT_TRUE(isExecutable(path)); + EXPECT_TRUE(os::exists(path + taskName(i))); + + EXPECT_EQ(1u, fetcherProcess->cacheSize()); + ASSERT_SOME(fetcherProcess->cacheFiles()); + EXPECT_EQ(1u, fetcherProcess->cacheFiles()->size()); + + verifyCacheMetrics(); + + EXPECT_SOME(os::rm(fetcherProcess->cacheFiles()->front())); + } +} + + TEST_F(FetcherCacheTest, CachedCustomFilename) { startSlave();
