X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/76be616a8a65a6c574026583c462640dcc9e706f..ac82dcc51a03f0ac1e3b6fc8e9e65ab86872ac26:/sdk/go/arvados/client_test.go diff --git a/sdk/go/arvados/client_test.go b/sdk/go/arvados/client_test.go index 422ad9037a..df938008d4 100644 --- a/sdk/go/arvados/client_test.go +++ b/sdk/go/arvados/client_test.go @@ -1,3 +1,7 @@ +// Copyright (C) The Arvados Authors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + package arvados import ( @@ -8,6 +12,7 @@ import ( "net/url" "sync" "testing" + "testing/iotest" ) type stubTransport struct { @@ -47,6 +52,22 @@ func (stub *errorTransport) RoundTrip(req *http.Request) (*http.Response, error) return nil, fmt.Errorf("something awful happened") } +type timeoutTransport struct { + response []byte +} + +func (stub *timeoutTransport) RoundTrip(req *http.Request) (*http.Response, error) { + return &http.Response{ + Status: "200 OK", + StatusCode: 200, + Proto: "HTTP/1.1", + ProtoMajor: 1, + ProtoMinor: 1, + Request: req, + Body: ioutil.NopCloser(iotest.TimeoutReader(bytes.NewReader(stub.response))), + }, nil +} + func TestCurrentUser(t *testing.T) { t.Parallel() stub := &stubTransport{ @@ -117,7 +138,7 @@ func TestAnythingToValues(t *testing.T) { }, }, { - in: map[string]interface{}{"foo": map[string]interface{}{"bar":1.234}}, + in: map[string]interface{}{"foo": map[string]interface{}{"bar": 1.234}}, ok: func(out url.Values) bool { return out.Get("foo") == `{"bar":1.234}` },