[ARVADOS] updated: 1.1.4-193-gda570c7
Git user
git at public.curoverse.com
Thu May 3 14:25:00 EDT 2018
Summary of changes:
sdk/go/keepclient/keepclient_test.go | 37 ++++++++++++++++--------------------
1 file changed, 16 insertions(+), 21 deletions(-)
via da570c74ba7949b5e5cc89cfa2db2af603890137 (commit)
from fd3a65529ae255a8c57552760707690437623b0a (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit da570c74ba7949b5e5cc89cfa2db2af603890137
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date: Thu May 3 14:24:45 2018 -0400
12167: Test X-Request-ID headers.
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>
diff --git a/sdk/go/keepclient/keepclient_test.go b/sdk/go/keepclient/keepclient_test.go
index 6815e1b..3b8de26 100644
--- a/sdk/go/keepclient/keepclient_test.go
+++ b/sdk/go/keepclient/keepclient_test.go
@@ -195,10 +195,12 @@ func (fh FailHandler) ServeHTTP(resp http.ResponseWriter, req *http.Request) {
type FailThenSucceedHandler struct {
handled chan string
count int
- successhandler StubGetHandler
+ successhandler http.Handler
+ reqIDs []string
}
func (fh *FailThenSucceedHandler) ServeHTTP(resp http.ResponseWriter, req *http.Request) {
+ fh.reqIDs = append(fh.reqIDs, req.Header.Get("X-Request-Id"))
if fh.count == 0 {
resp.WriteHeader(500)
fh.count += 1
@@ -560,8 +562,9 @@ func (s *StandaloneSuite) TestGetFail(c *C) {
func (s *StandaloneSuite) TestGetFailRetry(c *C) {
hash := fmt.Sprintf("%x", md5.Sum([]byte("foo")))
- st := &FailThenSucceedHandler{make(chan string, 1), 0,
- StubGetHandler{
+ st := &FailThenSucceedHandler{
+ handled: make(chan string, 1),
+ successhandler: StubGetHandler{
c,
hash,
"abc123",
@@ -585,6 +588,13 @@ func (s *StandaloneSuite) TestGetFailRetry(c *C) {
content, err2 := ioutil.ReadAll(r)
c.Check(err2, Equals, nil)
c.Check(content, DeepEquals, []byte("foo"))
+
+ c.Logf("%q", st.reqIDs)
+ c.Assert(len(st.reqIDs) > 1, Equals, true)
+ for _, reqid := range st.reqIDs {
+ c.Check(reqid, Not(Equals), "")
+ c.Check(reqid, Equals, st.reqIDs[0])
+ }
}
func (s *StandaloneSuite) TestGetNetError(c *C) {
@@ -1180,25 +1190,10 @@ func (s *StandaloneSuite) TestGetIndexWithNoSuchPrefix(c *C) {
c.Check(content, DeepEquals, st.body[0:len(st.body)-1])
}
-type FailThenSucceedPutHandler struct {
- handled chan string
- count int
- successhandler StubPutHandler
-}
-
-func (h *FailThenSucceedPutHandler) ServeHTTP(resp http.ResponseWriter, req *http.Request) {
- if h.count == 0 {
- resp.WriteHeader(500)
- h.count += 1
- h.handled <- fmt.Sprintf("http://%s", req.Host)
- } else {
- h.successhandler.ServeHTTP(resp, req)
- }
-}
-
func (s *StandaloneSuite) TestPutBRetry(c *C) {
- st := &FailThenSucceedPutHandler{make(chan string, 1), 0,
- StubPutHandler{
+ st := &FailThenSucceedHandler{
+ handled: make(chan string, 1),
+ successhandler: StubPutHandler{
c,
Md5String("foo"),
"abc123",
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list