aboutsummaryrefslogtreecommitdiff
path: root/internal/postgres/unit_test.go
diff options
context:
space:
mode:
authorEthan Lee <ethanalee@google.com>2026-03-18 20:31:16 +0000
committerGopher Robot <gobot@golang.org>2026-03-25 08:29:54 -0700
commitc57126f9757fb25c781a59cb9ecc97b0af63727a (patch)
tree48b516ffb19fc89d36ed25094c3a8f74a11b754a /internal/postgres/unit_test.go
parent86d1c7b3f2f2d36dbaf488d847c09e1655356ca7 (diff)
downloadgo-x-pkgsite-c57126f9757fb25c781a59cb9ecc97b0af63727a.tar.xz
all: add LatestVersion to ModuleInfo
- Add LatestVersion field to internal.ModuleInfo and update tests accordingly. - Changed some test formatting to improve readability. Change-Id: I1238e54614ef276d219b31d125cd2cad6b5a66f7 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/756901 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> kokoro-CI: kokoro <noreply+kokoro@google.com> Auto-Submit: Ethan Lee <ethanalee@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
Diffstat (limited to 'internal/postgres/unit_test.go')
-rw-r--r--internal/postgres/unit_test.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/internal/postgres/unit_test.go b/internal/postgres/unit_test.go
index a35d5658..2decf185 100644
--- a/internal/postgres/unit_test.go
+++ b/internal/postgres/unit_test.go
@@ -92,6 +92,7 @@ func testGetUnitMeta(t *testing.T, ctx context.Context) {
ModulePath: modPath,
Version: version,
IsRedistributable: true,
+ LatestVersion: "v1.1.0",
},
Name: name,
}
@@ -192,6 +193,19 @@ func testGetUnitMeta(t *testing.T, ctx context.Context) {
test.want.Name,
true,
)
+ latestGood := map[string]string{
+ "m.com": "v1.1.0",
+ "m.com/a": "v1.1.0",
+ "m.com/b": "v2.0.0+incompatible",
+ "cloud.google.com/go": "v0.74.0",
+ "cloud.google.com/go/pubsublite": "v0.4.0",
+ "cloud.google.com/go/compute/metadata": "v0.0.0-20181115181204-d50f0e9b2506",
+ }
+ want.LatestVersion = latestGood[want.ModulePath]
+ if want.LatestVersion == "" {
+ // Fallback to version if not in map (e.g. stdlib)
+ want.LatestVersion = want.Version
+ }
want.IsRedistributable = true
want.CommitTime = sample.CommitTime
want.Retracted = test.want.Retracted
@@ -819,6 +833,7 @@ func unitNoLicenses(fullPath, modulePath, version, name string, readme *internal
ModulePath: modulePath,
Version: version,
IsRedistributable: true,
+ LatestVersion: version,
},
Path: fullPath,
Name: name,