| 98 | |
| 99 | |
| 100 | TEST_F(FetcherTest, FileURI) |
| 101 | { |
| 102 | string fromDir = path::join(os::getcwd(), "from"); |
| 103 | ASSERT_SOME(os::mkdir(fromDir)); |
| 104 | string testFile = path::join(fromDir, "test"); |
| 105 | EXPECT_SOME(os::write(testFile, "data")); |
| 106 | |
| 107 | string localFile = path::join(os::getcwd(), "test"); |
| 108 | EXPECT_FALSE(os::exists(localFile)); |
| 109 | |
| 110 | slave::Flags flags = CreateSlaveFlags(); |
| 111 | |
| 112 | ContainerID containerId; |
| 113 | containerId.set_value(id::UUID::random().toString()); |
| 114 | |
| 115 | CommandInfo commandInfo; |
| 116 | CommandInfo::URI* uri = commandInfo.add_uris(); |
| 117 | uri->set_value(uri::from_path(testFile)); |
| 118 | |
| 119 | Fetcher fetcher(flags); |
| 120 | |
| 121 | Future<Nothing> fetch = fetcher.fetch( |
| 122 | containerId, commandInfo, os::getcwd(), None()); |
| 123 | AWAIT_READY(fetch); |
| 124 | |
| 125 | EXPECT_TRUE(os::exists(localFile)); |
| 126 | |
| 127 | verifyMetrics(1, 0); |
| 128 | } |
| 129 | |
| 130 | |
| 131 | // Verify that the fetcher cache correctly handles duplicates |
nothing calls this directly
no test coverage detected