aboutsummaryrefslogtreecommitdiff
path: root/internal/source/source_test.go
diff options
context:
space:
mode:
authorMichael Matloob <matloob@golang.org>2023-08-28 13:39:03 -0400
committerMichael Matloob <matloob@golang.org>2023-08-29 23:29:11 +0000
commitebe617b30c52774fccf9d36331cbff31e99aaf9e (patch)
tree9b413e7ec61ce6a08e169d8ab95eb3bca1b1effc /internal/source/source_test.go
parent6b2c42d38504a02ea8b77abc7c592b64aa39109d (diff)
downloadgo-x-pkgsite-ebe617b30c52774fccf9d36331cbff31e99aaf9e.tar.xz
internal/source: inject *http.Client into source.NewClient
This removes the dependency from package source onto ochttp. The users of source.NewClient that want an ochttp.Transport can set the transport on the *http.Client. For golang/go#61399 Change-Id: Ifb7126c482f664ee5a359f594d9324f0fd90f8b2 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/523510 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Findley <rfindley@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Michael Matloob <matloob@golang.org> kokoro-CI: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'internal/source/source_test.go')
-rw-r--r--internal/source/source_test.go8
1 files changed, 1 insertions, 7 deletions
diff --git a/internal/source/source_test.go b/internal/source/source_test.go
index 451e39f9..5343ae83 100644
--- a/internal/source/source_test.go
+++ b/internal/source/source_test.go
@@ -15,7 +15,6 @@ import (
"path/filepath"
"strings"
"testing"
- "time"
"github.com/google/go-cmp/cmp"
"github.com/google/go-replayers/httpreplay"
@@ -730,12 +729,7 @@ func TestRemoveVersionSuffix(t *testing.T) {
func TestAdjustVersionedModuleDirectory(t *testing.T) {
ctx := context.Background()
- testTimeout := 72 * time.Hour // arbitrary
- if deadline, ok := t.Deadline(); ok {
- testTimeout = time.Until(deadline) * 9 / 10 // Allow 10% for error reporting and cleanup.
- }
-
- client := NewClient(testTimeout)
+ client := NewClient(http.DefaultClient)
client.httpClient.Transport = testTransport(map[string]string{
// Repo "branch" follows the "major branch" convention: versions 2 and higher
// live in the same directory as versions 0 and 1, but on a different branch (or tag).