Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Unified Diff: common/lhttp/client_test.go

Issue 2984913002: Add HTTP error annotation. (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « common/lhttp/client.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: common/lhttp/client_test.go
diff --git a/common/lhttp/client_test.go b/common/lhttp/client_test.go
index 81f5a64f198053da866a137b1383df00cdf813cc..ae42629bb6957d0766f8002b8abe6ef85cf87afb 100644
--- a/common/lhttp/client_test.go
+++ b/common/lhttp/client_test.go
@@ -140,7 +140,7 @@ func TestNewRequestGETFail(t *testing.T) {
}, nil)
status, err := clientReq()
- So(err.Error(), ShouldResemble, "http request failed: Internal Server Error (HTTP 500) (attempts: 4)")
+ So(err.Error(), ShouldResemble, "gave up after 4 attempts: http request failed: Internal Server Error (HTTP 500)")
So(status, ShouldResemble, 500)
})
}
@@ -187,7 +187,7 @@ func TestGetJSONBadResult(t *testing.T) {
actual := map[string]string{}
status, err := GetJSON(ctx, fast, http.DefaultClient, ts.URL, &actual)
- So(err.Error(), ShouldResemble, "bad response "+ts.URL+": invalid character 'y' looking for beginning of value (attempts: 4)")
+ So(err.Error(), ShouldResemble, "gave up after 4 attempts: bad response "+ts.URL+": invalid character 'y' looking for beginning of value")
So(status, ShouldResemble, 200)
So(actual, ShouldResemble, map[string]string{})
})
@@ -207,7 +207,7 @@ func TestGetJSONBadResultIgnore(t *testing.T) {
defer ts.Close()
status, err := GetJSON(ctx, fast, http.DefaultClient, ts.URL, nil)
- So(err.Error(), ShouldResemble, "bad response "+ts.URL+": invalid character 'y' looking for beginning of value (attempts: 4)")
+ So(err.Error(), ShouldResemble, "gave up after 4 attempts: bad response "+ts.URL+": invalid character 'y' looking for beginning of value")
So(status, ShouldResemble, 200)
})
}
@@ -223,7 +223,7 @@ func TestGetJSONBadContentTypeIgnore(t *testing.T) {
defer ts.Close()
status, err := GetJSON(ctx, fast, http.DefaultClient, ts.URL, nil)
- So(err.Error(), ShouldResemble, "unexpected Content-Type, expected \"application/json\", got \"text/plain; charset=utf-8\" (attempts: 4)")
+ So(err.Error(), ShouldResemble, "gave up after 4 attempts: unexpected Content-Type, expected \"application/json\", got \"text/plain; charset=utf-8\"")
So(status, ShouldResemble, 200)
})
}
« no previous file with comments | « common/lhttp/client.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698