aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/platform/cloud/gcs_file_system_test.cc
diff options
context:
space:
mode:
authorGravatar Jonathan Hseu <jhseu@google.com>2018-02-28 16:22:42 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-02-28 16:26:38 -0800
commite670c81d85f3353ea3b701569f8f5126714a02bf (patch)
treefc0a5de24744968447a4e83be8c9d0559c24a55b /tensorflow/core/platform/cloud/gcs_file_system_test.cc
parenta5b336194f4fd1a26bcd5dfd159d6edf4dfdd081 (diff)
GCS: HTTP error code 308 retries during upload. Previously, it would only permit 308 when getting the status of an upload.
This matches the behavior of the official library: https://github.com/google/apitools/blob/master/apitools/base/py/transfer.py#L925 And the general description here: https://cloud.google.com/storage/docs/json_api/v1/how-tos/resumable-upload PiperOrigin-RevId: 187400843
Diffstat (limited to 'tensorflow/core/platform/cloud/gcs_file_system_test.cc')
-rw-r--r--tensorflow/core/platform/cloud/gcs_file_system_test.cc33
1 files changed, 23 insertions, 10 deletions
diff --git a/tensorflow/core/platform/cloud/gcs_file_system_test.cc b/tensorflow/core/platform/cloud/gcs_file_system_test.cc
index d452074ce3..cd9fd3adea 100644
--- a/tensorflow/core/platform/cloud/gcs_file_system_test.cc
+++ b/tensorflow/core/platform/cloud/gcs_file_system_test.cc
@@ -393,7 +393,7 @@ TEST(GcsFileSystemTest, NewWritableFile_ResumeUploadSucceeds) {
"Timeouts: 5 1 10\n"
"Header Content-Range: bytes */17\n"
"Put: yes\n",
- "", errors::FailedPrecondition("308"), nullptr,
+ "", errors::Unavailable("308"), nullptr,
{{"Range", "0-10"}}, 308),
new FakeHttpRequest("Uri: https://custom/upload/location\n"
"Auth Token: fake_token\n"
@@ -406,13 +406,26 @@ TEST(GcsFileSystemTest, NewWritableFile_ResumeUploadSucceeds) {
"Timeouts: 5 1 10\n"
"Header Content-Range: bytes */17\n"
"Put: yes\n",
- "", errors::FailedPrecondition("308"), nullptr,
+ "", errors::Unavailable("308"), nullptr,
{{"Range", "bytes=0-12"}}, 308),
new FakeHttpRequest("Uri: https://custom/upload/location\n"
"Auth Token: fake_token\n"
"Header Content-Range: bytes 13-16/17\n"
"Timeouts: 5 1 30\n"
"Put body: ent2\n",
+ "", errors::Unavailable("308"), 308),
+ new FakeHttpRequest("Uri: https://custom/upload/location\n"
+ "Auth Token: fake_token\n"
+ "Timeouts: 5 1 10\n"
+ "Header Content-Range: bytes */17\n"
+ "Put: yes\n",
+ "", errors::Unavailable("308"), nullptr,
+ {{"Range", "bytes=0-14"}}, 308),
+ new FakeHttpRequest("Uri: https://custom/upload/location\n"
+ "Auth Token: fake_token\n"
+ "Header Content-Range: bytes 15-16/17\n"
+ "Timeouts: 5 1 30\n"
+ "Put body: t2\n",
"")});
GcsFileSystem fs(std::unique_ptr<AuthProvider>(new FakeAuthProvider),
std::unique_ptr<HttpRequest::Factory>(
@@ -521,14 +534,14 @@ TEST(GcsFileSystemTest, NewWritableFile_ResumeUploadAllAttemptsFail) {
"Put body: content1,content2\n",
"", errors::Unavailable("503"), 503)});
for (int i = 0; i < 10; i++) {
- requests.emplace_back(new FakeHttpRequest(
- "Uri: https://custom/upload/location\n"
- "Auth Token: fake_token\n"
- "Timeouts: 5 1 10\n"
- "Header Content-Range: bytes */17\n"
- "Put: yes\n",
- "", errors::FailedPrecondition("important HTTP error 308"), nullptr,
- {{"Range", "0-10"}}, 308));
+ requests.emplace_back(
+ new FakeHttpRequest("Uri: https://custom/upload/location\n"
+ "Auth Token: fake_token\n"
+ "Timeouts: 5 1 10\n"
+ "Header Content-Range: bytes */17\n"
+ "Put: yes\n",
+ "", errors::Unavailable("important HTTP error 308"),
+ nullptr, {{"Range", "0-10"}}, 308));
requests.emplace_back(new FakeHttpRequest(
"Uri: https://custom/upload/location\n"
"Auth Token: fake_token\n"