aboutsummaryrefslogtreecommitdiff
path: root/internal/fetchdatasource/fetchdatasource_test.go
diff options
context:
space:
mode:
authorJonathan Amsterdam <jba@google.com>2021-09-04 05:23:12 -0400
committerJonathan Amsterdam <jba@google.com>2021-09-07 14:03:19 +0000
commit7c857cb7e953af2a1e1492e400cb4104da732f07 (patch)
tree5fc8a80dd44a58d623aad884efd1904dd9fc89e4 /internal/fetchdatasource/fetchdatasource_test.go
parent52c9ed16737fe8b27ed8016b9ae97cedac1bab1b (diff)
downloadgo-x-pkgsite-7c857cb7e953af2a1e1492e400cb4104da732f07.tar.xz
internal/fetch: get source info from module getter
Make it the ModuleGetter's responsibility to provide links to source files, instead of passing around a separate source.Client. This will allow getters that fetch from disk to serve those local files. For golang/go#47982 Change-Id: I6c7cd7890b03ad61d9410850a510c1c9a63f1c9a Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/347749 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
Diffstat (limited to 'internal/fetchdatasource/fetchdatasource_test.go')
-rw-r--r--internal/fetchdatasource/fetchdatasource_test.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/internal/fetchdatasource/fetchdatasource_test.go b/internal/fetchdatasource/fetchdatasource_test.go
index e807ec7a..b274da17 100644
--- a/internal/fetchdatasource/fetchdatasource_test.go
+++ b/internal/fetchdatasource/fetchdatasource_test.go
@@ -125,12 +125,11 @@ func setup(t *testing.T, testModules []*proxytest.Module, bypassLicenseCheck boo
getters := localGetters
if testModules != nil {
- getters = append(getters, fetch.NewProxyModuleGetter(client))
+ getters = append(getters, fetch.NewProxyModuleGetter(client, source.NewClientForTesting()))
}
return ctx, Options{
Getters: getters,
- SourceClient: source.NewClientForTesting(),
ProxyClientForLatest: client,
BypassLicenseCheck: bypassLicenseCheck,
}.New(), func() {
@@ -340,7 +339,9 @@ func TestLocalGetUnitMeta(t *testing.T) {
ctx, ds, teardown := setup(t, defaultTestModules, true)
defer teardown()
- sourceInfo := source.NewGitHubInfo("https://github.com/my/module", "", "v0.0.0")
+ // TODO(golang/go#47982): use the correct sourceInfo here.
+ var sourceInfo *source.Info
+
for _, test := range []struct {
path, modulePath string
want *internal.UnitMeta