Skip to content

Commit 2cbec65

Browse files
committed
internal/worker: replace GetModuleInfo with LegacyGetModuleInfo
Tests in internal/worker now use GetModuleInfo instead of LegacyGetModuleInfo. Updates golang/go#39629 Change-Id: I524750809c3e2dcf795bb026636fb76aeba280db Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/241064 Reviewed-by: Jonathan Amsterdam <[email protected]>
1 parent b023408 commit 2cbec65

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

internal/worker/fetch_test.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func TestFetchAndUpdateState_NotFound(t *testing.T) {
102102
// Verify that the module status is recorded correctly, and that the version is in the DB.
103103
checkStatus(http.StatusOK)
104104

105-
if _, err := testDB.LegacyGetModuleInfo(ctx, modulePath, version); err != nil {
105+
if _, err := testDB.GetModuleInfo(ctx, modulePath, version); err != nil {
106106
t.Fatal(err)
107107
}
108108

@@ -151,8 +151,8 @@ func TestFetchAndUpdateState_NotFound(t *testing.T) {
151151
// - It shouldn't be in the modules table. That also covers licenses, packages and paths tables
152152
// via foreign key constraints with ON DELETE CASCADE.
153153
// - It shouldn't be in other tables like search_documents and the various imports tables.
154-
if _, err := testDB.LegacyGetModuleInfo(ctx, modulePath, version); !errors.Is(err, derrors.NotFound) {
155-
t.Fatalf("LegacyGetModuleInfo: got %v, want NotFound", err)
154+
if _, err := testDB.GetModuleInfo(ctx, modulePath, version); !errors.Is(err, derrors.NotFound) {
155+
t.Fatalf("GetModuleInfo: got %v, want NotFound", err)
156156
}
157157

158158
checkNotInTable := func(table, column string) {
@@ -197,7 +197,7 @@ func checkModuleNotFound(t *testing.T, ctx context.Context, modulePath, version
197197
if code != wantCode || !errors.Is(err, wantErr) {
198198
t.Fatalf("got %d, %v; want %d, Is(err, %v)", code, err, wantCode, wantErr)
199199
}
200-
_, err = testDB.LegacyGetModuleInfo(ctx, modulePath, version)
200+
_, err = testDB.GetModuleInfo(ctx, modulePath, version)
201201
if !errors.Is(err, derrors.NotFound) {
202202
t.Fatalf("got %v, want Is(NotFound)", err)
203203
}
@@ -342,7 +342,7 @@ func TestFetchAndUpdateState_Mismatch(t *testing.T) {
342342
if code != wantCode || !errors.Is(err, wantErr) {
343343
t.Fatalf("got %d, %v; want %d, Is(err, derrors.AlternativeModule)", code, err, wantCode)
344344
}
345-
_, err = testDB.LegacyGetModuleInfo(ctx, modulePath, version)
345+
_, err = testDB.GetModuleInfo(ctx, modulePath, version)
346346
if !errors.Is(err, derrors.NotFound) {
347347
t.Fatalf("got %v, want Is(NotFound)", err)
348348
}
@@ -1052,12 +1052,12 @@ func TestFetchAndInsertModule(t *testing.T) {
10521052
t.Fatalf("FetchAndUpdateState(%q, %q, %v, %v, %v): %v", test.modulePath, test.version, proxyClient, sourceClient, testDB, err)
10531053
}
10541054

1055-
gotModuleInfo, err := testDB.LegacyGetModuleInfo(ctx, test.modulePath, test.version)
1055+
gotModuleInfo, err := testDB.GetModuleInfo(ctx, test.modulePath, test.want.Version)
10561056
if err != nil {
10571057
t.Fatal(err)
10581058
}
1059-
if diff := cmp.Diff(test.want.LegacyModuleInfo, *gotModuleInfo, cmp.AllowUnexported(source.Info{})); diff != "" {
1060-
t.Fatalf("testDB.LegacyGetModuleInfo(ctx, %q, %q) mismatch (-want +got):\n%s", test.modulePath, test.version, diff)
1059+
if diff := cmp.Diff(test.want.ModuleInfo, *gotModuleInfo, cmp.AllowUnexported(source.Info{})); diff != "" {
1060+
t.Fatalf("testDB.GetModuleInfo(ctx, %q, %q) mismatch (-want +got):\n%s", test.modulePath, test.version, diff)
10611061
}
10621062

10631063
gotPkg, err := testDB.LegacyGetPackage(ctx, test.pkg, internal.UnknownModulePath, test.version)

0 commit comments

Comments
 (0)