aboutsummaryrefslogtreecommitdiff
path: root/internal/postgres/unit_test.go
diff options
context:
space:
mode:
authorJonathan Amsterdam <jba@google.com>2021-04-07 12:43:30 -0400
committerJonathan Amsterdam <jba@google.com>2021-04-07 17:15:13 +0000
commitb3344a7197e09f77cc3b911a8de8b2f69eb0206c (patch)
tree536e21f98a9cb8c22597c03e05350e1697af1f7b /internal/postgres/unit_test.go
parent668263d32c7c9b93fd062b90a9081104ae03611e (diff)
downloadgo-x-pkgsite-b3344a7197e09f77cc3b911a8de8b2f69eb0206c.tar.xz
internal/postgres: use MustInsertModuleLatest
For most internal/postgres tests, update latest-version information when we insert a module. That is more like what actually happens on the worker, and some features now rely on it, so we should do it everywhere. Some tests still use a custom go.mod file, so we can't switch to MustInsertModuleLatest for those, because it uses a minimal go.mod file. Change-Id: Ie5030aee4ed9c837931fddb8757e37bf6373a8c7 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/307871 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'internal/postgres/unit_test.go')
-rw-r--r--internal/postgres/unit_test.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/internal/postgres/unit_test.go b/internal/postgres/unit_test.go
index df031284..0e0e4374 100644
--- a/internal/postgres/unit_test.go
+++ b/internal/postgres/unit_test.go
@@ -332,7 +332,7 @@ func TestGetUnitMetaBypass(t *testing.T) {
m := sample.Module(testModule.module, testModule.version, testModule.packageSuffix)
makeModuleNonRedistributable(m)
- MustInsertModule(ctx, t, bypassDB, m)
+ MustInsertModuleLatest(ctx, t, bypassDB, m)
requested := m.Version
if testModule.isMaster {
requested = "master"
@@ -711,7 +711,7 @@ func TestGetUnit(t *testing.T) {
Filepath: "PKG_README.md",
Contents: "pkg readme",
}
- MustInsertModule(ctx, t, testDB, m)
+ MustInsertModuleLatest(ctx, t, testDB, m)
// Add a module that has documentation for two Go build contexts.
m = sample.Module("a.com/twodoc", "v1.2.3", "p")
@@ -721,7 +721,7 @@ func TestGetUnit(t *testing.T) {
sample.Documentation("windows", "amd64", `package p; var W int`),
}
pkg.Documentation = docs2
- MustInsertModule(ctx, t, testDB, m)
+ MustInsertModuleLatest(ctx, t, testDB, m)
for _, test := range []struct {
name, path, modulePath, version string
@@ -893,7 +893,7 @@ func TestGetUnit_SubdirectoriesShowNonRedistPackages(t *testing.T) {
m := sample.DefaultModule()
m.IsRedistributable = false
m.Packages()[0].IsRedistributable = false
- MustInsertModule(ctx, t, testDB, m)
+ MustInsertModuleLatest(ctx, t, testDB, m)
}
func TestGetUnitFieldSet(t *testing.T) {
@@ -910,7 +910,7 @@ func TestGetUnitFieldSet(t *testing.T) {
// Add a module that has READMEs in a directory and a package.
m := sample.Module("a.com/m", "v1.2.3", "dir/p")
m.Packages()[0].Readme = readme
- MustInsertModule(ctx, t, testDB, m)
+ MustInsertModuleLatest(ctx, t, testDB, m)
cleanFields := func(u *internal.Unit, fields internal.FieldSet) {
// Add/remove fields based on the FieldSet specified.
@@ -1034,7 +1034,7 @@ func TestGetUnitBypass(t *testing.T) {
bypassDB := NewBypassingLicenseCheck(testDB.db)
m := nonRedistributableModule()
- MustInsertModule(ctx, t, bypassDB, m)
+ MustInsertModuleLatest(ctx, t, bypassDB, m)
for _, test := range []struct {
db *DB