aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/platform/cloud/gcs_file_system_test.cc
diff options
context:
space:
mode:
authorGravatar Ruoxin Sang <rxsang@google.com>2018-05-22 15:51:17 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-05-22 15:53:16 -0700
commit7f75fc526898c4c030b5c6f30deb331fcff7b70c (patch)
tree7aae505bbdac8d962a4d385e37f7c6bf2c5b5bcd /tensorflow/core/platform/cloud/gcs_file_system_test.cc
parentb7d3d31a78ce90fd9733d67247ae34c694199d19 (diff)
Always append the trailing slash when look up or insert a directory path in the stat cache.
PiperOrigin-RevId: 197637482
Diffstat (limited to 'tensorflow/core/platform/cloud/gcs_file_system_test.cc')
-rw-r--r--tensorflow/core/platform/cloud/gcs_file_system_test.cc16
1 files changed, 12 insertions, 4 deletions
diff --git a/tensorflow/core/platform/cloud/gcs_file_system_test.cc b/tensorflow/core/platform/cloud/gcs_file_system_test.cc
index bb4ace65a9..3f73b238ad 100644
--- a/tensorflow/core/platform/cloud/gcs_file_system_test.cc
+++ b/tensorflow/core/platform/cloud/gcs_file_system_test.cc
@@ -1107,7 +1107,7 @@ TEST(GcsFileSystemTest, FileExists_StatCache) {
"\"updated\": \"2016-04-29T23:15:24.896Z\"}")),
new FakeHttpRequest(
"Uri: https://www.googleapis.com/storage/v1/b/bucket/o/"
- "path%2Fsubfolder?fields=size%2Cgeneration%2Cupdated\n"
+ "path%2Fsubfolder%2F?fields=size%2Cgeneration%2Cupdated\n"
"Auth Token: fake_token\n"
"Timeouts: 5 1 10\n",
"", errors::NotFound("404"), 404),
@@ -1133,7 +1133,7 @@ TEST(GcsFileSystemTest, FileExists_StatCache) {
// HTTP requests.
for (int i = 0; i < 10; i++) {
TF_EXPECT_OK(fs.FileExists("gs://bucket/path/file1.txt"));
- TF_EXPECT_OK(fs.FileExists("gs://bucket/path/subfolder"));
+ TF_EXPECT_OK(fs.FileExists("gs://bucket/path/subfolder/"));
}
}
@@ -1932,6 +1932,14 @@ TEST(GcsFileSystemTest, RenameFile_Object) {
"Range: 0-15\n"
"Timeouts: 5 1 20\n",
"76543210"),
+ // IsDirectory is checking whether there are children objects.
+ new FakeHttpRequest(
+ "Uri: https://www.googleapis.com/storage/v1/b/bucket/o?"
+ "fields=items%2Fname%2CnextPageToken&prefix=path%2Fsrc.txt%2F"
+ "&maxResults=1\n"
+ "Auth Token: fake_token\n"
+ "Timeouts: 5 1 10\n",
+ "{}"),
// Copying to the new location.
new FakeHttpRequest(
"Uri: https://www.googleapis.com/storage/v1/b/bucket/o/"
@@ -2318,7 +2326,7 @@ TEST(GcsFileSystemTest, Stat_Cache) {
"\"updated\": \"2016-04-29T23:15:24.896Z\"}")),
new FakeHttpRequest(
"Uri: https://www.googleapis.com/storage/v1/b/bucket/o/"
- "subfolder?fields=size%2Cgeneration%2Cupdated\n"
+ "subfolder%2F?fields=size%2Cgeneration%2Cupdated\n"
"Auth Token: fake_token\n"
"Timeouts: 5 1 10\n",
"", errors::NotFound("404"), 404),
@@ -2348,7 +2356,7 @@ TEST(GcsFileSystemTest, Stat_Cache) {
EXPECT_EQ(1010, stat.length);
EXPECT_NEAR(1461971724896, stat.mtime_nsec / 1000 / 1000, 1);
EXPECT_FALSE(stat.is_directory);
- TF_EXPECT_OK(fs.Stat("gs://bucket/subfolder", &stat));
+ TF_EXPECT_OK(fs.Stat("gs://bucket/subfolder/", &stat));
EXPECT_EQ(0, stat.length);
EXPECT_EQ(0, stat.mtime_nsec);
EXPECT_TRUE(stat.is_directory);