mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-22 22:58:25 +00:00
lib/upgrade: Remove TestGithubRelease (fixes #3362)
Skip-check: authors GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3365
This commit is contained in:
parent
80fd6c2400
commit
a9ee4bb9f1
3814
lib/upgrade/testdata/github-releases.json
vendored
3814
lib/upgrade/testdata/github-releases.json
vendored
File diff suppressed because it is too large
Load Diff
@ -9,8 +9,6 @@
|
|||||||
package upgrade
|
package upgrade
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"os"
|
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
@ -59,35 +57,6 @@ func TestCompareVersions(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGithubRelease(t *testing.T) {
|
|
||||||
var upgrades = map[string]string{
|
|
||||||
"v0.10.21": "v0.10.30",
|
|
||||||
"v0.10.29": "v0.10.30",
|
|
||||||
"v0.10.0-alpha": "v0.10.30",
|
|
||||||
"v0.10.0-beta": "v0.10.30",
|
|
||||||
"v0.11.0-beta0+40-g53cb66e-dirty": "v0.11.0-beta0",
|
|
||||||
}
|
|
||||||
|
|
||||||
fd, err := os.Open("testdata/github-releases.json")
|
|
||||||
if err != nil {
|
|
||||||
t.Errorf("Missing github-release test data")
|
|
||||||
}
|
|
||||||
defer fd.Close()
|
|
||||||
|
|
||||||
var rels []Release
|
|
||||||
json.NewDecoder(fd).Decode(&rels)
|
|
||||||
|
|
||||||
for old, target := range upgrades {
|
|
||||||
upgrade, err := SelectLatestRelease(old, rels)
|
|
||||||
if err != nil {
|
|
||||||
t.Error("Error retrieving latest version", err)
|
|
||||||
}
|
|
||||||
if upgrade.Tag != target {
|
|
||||||
t.Errorf("Invalid upgrade release: %v -> %v, but got %v", old, target, upgrade.Tag)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestErrorRelease(t *testing.T) {
|
func TestErrorRelease(t *testing.T) {
|
||||||
_, err := SelectLatestRelease("v0.11.0-beta", nil)
|
_, err := SelectLatestRelease("v0.11.0-beta", nil)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user