MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / TEST

Function TEST

tensorflow/core/platform/cloud/retrying_file_system_test.cc:184–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182};
183
184TEST(RetryingFileSystemTest, NewRandomAccessFile_ImmediateSuccess) {
185 // Configure the mock base random access file.
186 ExpectedCalls expected_file_calls({std::make_tuple("Name", Status::OK()),
187 std::make_tuple("Read", Status::OK())});
188 std::unique_ptr<RandomAccessFile> base_file(
189 new MockRandomAccessFile(expected_file_calls));
190
191 // Configure the mock base file system.
192 ExpectedCalls expected_fs_calls(
193 {std::make_tuple("NewRandomAccessFile", Status::OK())});
194 std::unique_ptr<MockFileSystem> base_fs(
195 new MockFileSystem(expected_fs_calls));
196 base_fs->random_access_file_to_return = std::move(base_file);
197 RetryingFileSystem<MockFileSystem> fs(
198 std::move(base_fs), RetryConfig(0 /* init_delay_time_us */));
199
200 // Retrieve the wrapped random access file.
201 std::unique_ptr<RandomAccessFile> random_access_file;
202 TF_EXPECT_OK(fs.NewRandomAccessFile("filename.txt", &random_access_file));
203
204 // Use it and check the results.
205 StringPiece result;
206 TF_EXPECT_OK(random_access_file->Name(&result));
207 EXPECT_EQ(result, "");
208
209 char scratch[10];
210 TF_EXPECT_OK(random_access_file->Read(0, 10, &result, scratch));
211}
212
213TEST(RetryingFileSystemTest, NewRandomAccessFile_SuccessWith3rdTry) {
214 // Configure the mock base random access file.

Callers

nothing calls this directly

Calls 15

RetryConfigClass · 0.85
UnavailableFunction · 0.85
CreateRetriableErrorsFunction · 0.85
FailedPreconditionFunction · 0.85
StrContainsFunction · 0.50
NewRandomAccessFileMethod · 0.45
NameMethod · 0.45
ReadMethod · 0.45
NewWritableFileMethod · 0.45
SyncMethod · 0.45
resetMethod · 0.45
NewAppendableFileMethod · 0.45

Tested by

no test coverage detected