@@ -109,7 +109,9 @@ class MockFileSystem : public FileSystem {
109109 return calls_.ConsumeNextCall (" NewReadOnlyMemoryRegionFromFile" );
110110 }
111111
112- Status FileExists (const string& fname) override { return Status::OK (); }
112+ Status FileExists (const string& fname) override {
113+ return calls_.ConsumeNextCall (" FileExists" );
114+ }
113115
114116 Status GetChildren (const string& dir, std::vector<string>* result) override {
115117 return calls_.ConsumeNextCall (" GetChildren" );
@@ -619,6 +621,26 @@ TEST(RetryingFileSystemTest, FileExists_SuccessWith2ndTry) {
619621 TF_EXPECT_OK (fs.FileExists (" gs://path/dir" ));
620622}
621623
624+ TEST (RetryingFileSystemTest, FileExists_AllRetriesFailed) {
625+ ExpectedCalls expected_fs_calls = CreateRetriableErrors (" FileExists" , 6 );
626+ std::unique_ptr<MockFileSystem> base_fs (
627+ new MockFileSystem (expected_fs_calls));
628+ RetryingFileSystem fs (std::move (base_fs), 0 );
629+
630+ EXPECT_EQ (" Retriable error #5" , fs.FileExists (" file_name" ).error_message ());
631+ }
632+
633+ TEST (RetryingFileSystemTest, FileExists_SuccessWith2ndTry) {
634+ ExpectedCalls expected_fs_calls (
635+ {std::make_tuple (" FileExists" , errors::Unavailable (" Something is wrong" )),
636+ std::make_tuple (" FileExists" , Status::OK ())});
637+ std::unique_ptr<MockFileSystem> base_fs (
638+ new MockFileSystem (expected_fs_calls));
639+ RetryingFileSystem fs (std::move (base_fs), 0 );
640+
641+ TF_EXPECT_OK (fs.FileExists (" gs://path/dir" ));
642+ }
643+
622644TEST (RetryingFileSystemTest, IsDirectory_SuccessWith2ndTry) {
623645 ExpectedCalls expected_fs_calls (
624646 {std::make_tuple (" IsDirectory" ,
0 commit comments