X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/a74c81b035c67d299e2a7298f8db3d368a578510..88bb9b9fc4392f4a3514ae59e3ffd454d3ce90a8:/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{