release: prepare server 0.9.2
Build and test / Tests and license checks (push) Has been cancelled
Build and test / OpenWrt 24.10.7 · x86-64 (push) Has been cancelled
Build and test / OpenWrt 25.12.4 · x86-64 (push) Has been cancelled
Build and test / OpenWrt 24.10.7 · ipq40xx-generic (push) Has been cancelled
Build and test / OpenWrt 25.12.4 · ipq40xx-generic (push) Has been cancelled
Build and test / OpenWrt 24.10.7 · mediatek-filogic (push) Has been cancelled
Build and test / OpenWrt 25.12.4 · mediatek-filogic (push) Has been cancelled
Build and test / OpenWrt 24.10.7 · ath79-generic (push) Has been cancelled
Build and test / OpenWrt 25.12.4 · ath79-generic (push) Has been cancelled
Build and test / OpenWrt 24.10.7 · ramips-mt7621 (push) Has been cancelled
Build and test / OpenWrt 25.12.4 · ramips-mt7621 (push) Has been cancelled
Build and test / Publish agent GitHub release assets (push) Has been cancelled
Build and test / Publish signed package repository (push) Has been cancelled
Release server / Test and build server image (push) Has been cancelled
Build and test / Tests and license checks (push) Has been cancelled
Build and test / OpenWrt 24.10.7 · x86-64 (push) Has been cancelled
Build and test / OpenWrt 25.12.4 · x86-64 (push) Has been cancelled
Build and test / OpenWrt 24.10.7 · ipq40xx-generic (push) Has been cancelled
Build and test / OpenWrt 25.12.4 · ipq40xx-generic (push) Has been cancelled
Build and test / OpenWrt 24.10.7 · mediatek-filogic (push) Has been cancelled
Build and test / OpenWrt 25.12.4 · mediatek-filogic (push) Has been cancelled
Build and test / OpenWrt 24.10.7 · ath79-generic (push) Has been cancelled
Build and test / OpenWrt 25.12.4 · ath79-generic (push) Has been cancelled
Build and test / OpenWrt 24.10.7 · ramips-mt7621 (push) Has been cancelled
Build and test / OpenWrt 25.12.4 · ramips-mt7621 (push) Has been cancelled
Build and test / Publish agent GitHub release assets (push) Has been cancelled
Build and test / Publish signed package repository (push) Has been cancelled
Release server / Test and build server image (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
package httpapi
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestTrustedHistoricalManifestURL(t *testing.T) {
|
||||
base := "https://packages.example.test/releases/update-manifest.json"
|
||||
for _, value := range []string{
|
||||
"https://packages.example.test/releases/0.6.8/manifest.json",
|
||||
"https://packages.example.test/releases/0.6.8/manifest.sig",
|
||||
} {
|
||||
if !trustedHistoricalManifestURL(base, value) {
|
||||
t.Fatalf("expected %q to be trusted", value)
|
||||
}
|
||||
}
|
||||
for _, value := range []string{
|
||||
"http://packages.example.test/releases/0.6.8/manifest.json",
|
||||
"https://other.example.test/releases/manifest.json",
|
||||
"https://packages.example.test/other/manifest.json",
|
||||
"https://packages.example.test/releases/manifest.json?x=1",
|
||||
} {
|
||||
if trustedHistoricalManifestURL(base, value) {
|
||||
t.Fatalf("expected %q to be rejected", value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestCompareSemver(t *testing.T) {
|
||||
for _, test := range []struct {
|
||||
left, right string
|
||||
want int
|
||||
}{
|
||||
{"0.6.8", "0.6.9", -1},
|
||||
{"0.6.9", "0.6.9", 0},
|
||||
{"0.7.0", "0.6.9", 1},
|
||||
{"0.6.9-rc.1", "0.6.9", -1},
|
||||
{"0.6.9-rc.10", "0.6.9-rc.2", 1},
|
||||
} {
|
||||
got := compareSemver(test.left, test.right)
|
||||
if (got < 0 && test.want < 0) || (got == 0 && test.want == 0) || (got > 0 && test.want > 0) {
|
||||
continue
|
||||
}
|
||||
t.Fatalf("compareSemver(%q, %q) = %d, want sign %d", test.left, test.right, got, test.want)
|
||||
}
|
||||
if compareSemver("invalid", "0.6.9") <= 0 {
|
||||
t.Fatal("invalid version must not be accepted as a rollback target")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user