aboutsummaryrefslogtreecommitdiff
path: root/internal/postgres/insert_module_test.go
diff options
context:
space:
mode:
authorJulie Qiu <julie@golang.org>2020-09-13 16:54:26 -0400
committerJulie Qiu <julie@golang.org>2020-09-14 22:24:33 +0000
commita6259aefc2cb18eeb59af105e688120798a3ec81 (patch)
tree07702e25f1169ea1c9ab43e2f51bb2c63abb9ec8 /internal/postgres/insert_module_test.go
parent2d8c44f7ce4d2f99664d5c4824b625e14439ffdf (diff)
downloadgo-x-pkgsite-a6259aefc2cb18eeb59af105e688120798a3ec81.tar.xz
internal/postgres: prefer prerelease over pseudo as latest version
The definition of @latest is changed to prefer pre-release versions over pseudo-versions. This matches the definition of @latest for the go command as of go1.13. For golang/go#41379 Change-Id: Ia5e4cc42822245636d216467aee1e088a40569c5 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/254577 Run-TryBot: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> Trust: Julie Qiu <julie@golang.org>
Diffstat (limited to 'internal/postgres/insert_module_test.go')
-rw-r--r--internal/postgres/insert_module_test.go15
1 files changed, 13 insertions, 2 deletions
diff --git a/internal/postgres/insert_module_test.go b/internal/postgres/insert_module_test.go
index b1f8c406..6dcde6a6 100644
--- a/internal/postgres/insert_module_test.go
+++ b/internal/postgres/insert_module_test.go
@@ -356,8 +356,6 @@ func TestPostgres_ReadAndWriteModuleOtherColumns(t *testing.T) {
}
func TestLatestVersion(t *testing.T) {
- // Verify that finding the latest version of a module prefers
- // non-incompatible versions first.
defer ResetTestDB(testDB, t)
ctx := context.Background()
@@ -377,6 +375,14 @@ func TestLatestVersion(t *testing.T) {
version: "v2.0.1",
modulePath: sample.ModulePath + "/v2",
},
+ {
+ version: "v3.0.1-rc9.0.20200212222136-a4a89636720b",
+ modulePath: sample.ModulePath + "/v3",
+ },
+ {
+ version: "v3.0.1-rc9",
+ modulePath: sample.ModulePath + "/v3",
+ },
} {
m := sample.DefaultModule()
m.Version = mod.version
@@ -402,6 +408,11 @@ func TestLatestVersion(t *testing.T) {
modulePath: sample.ModulePath + "/v2",
wantVersion: "v2.0.1",
},
+ {
+ name: "test v3 version - prefer prerelease over pseudo",
+ modulePath: sample.ModulePath + "/v3",
+ wantVersion: "v3.0.1-rc9",
+ },
} {
t.Run(tc.name, func(t *testing.T) {
isLatest, err := isLatestVersion(ctx, testDB.db, tc.modulePath, tc.wantVersion)