X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/f9e3d32c92920a806d50548dbb9b6c0aab7d8c54..c9aaa4d329b08c8b1c8cfd566c5282ab57e97f05:/sdk/go/arvados/client_test.go diff --git a/sdk/go/arvados/client_test.go b/sdk/go/arvados/client_test.go index 5011aa81f6..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{