Files
Felis/internal/updater/topology_test.go
T
Lemon-miaow 2c6739ad76 fix(updater,install,docs): follow the move to FelisMC/Felis (#53)
The repository moved to FelisMC/Felis, but the felis-api release coordinate, the installer's default FELIS_REPO_URL, the PaperMC user-agent strings and both READMEs still named MliroLirrorsIngenuity/Felis. Live on the audit box, 'felis update' reported 'github: MliroLirrorsIngenuity/Felis releases/latest returned HTTP 404 -- ...', pointing operators at a coordinate that no longer exists; the old path keeps answering today only because GitHub still 301s the transfer (verified with a read token against api.github.com: old path 301, new path 200), and if that redirect is ever retired every install and every update check breaks with it.

Replace the coordinate in the six tracked files: the updater topology and both test fixtures, the bootstrap default URL and user-agent strings, and README.md/README_EN.md. Green live: the same command now reports 'github: FelisMC/Felis releases/latest returned HTTP 404 -- ...' (still 404 because the new home has published no stable release yet -- a release-process fact, not a code bug).

Gates: gofmt, go vet, go test ./..., deploy/bootstrap_test.sh all clean.
2026-09-23 20:58:34 +08:00

49 lines
1.9 KiB
Go

package updater
import (
"testing"
"felis.lolicon.best/internal/updates"
)
// TestTopologyEncodesPolicies pins the user's stated decisions: which components Felis
// tracks and how aggressively. A regression here would silently change what Felis is
// allowed to auto-apply.
func TestTopologyEncodesPolicies(t *testing.T) {
want := map[string]Spec{
"felis-api": {Name: "felis-api", Policy: updates.PolicyScheduled, Manageable: true, Source: sourceGitHub, Coord: "FelisMC/Felis"},
"k3s": {Name: "k3s", Policy: updates.PolicyNotify, Manageable: false, Source: sourceGitHub, Coord: "k3s-io/k3s"},
"cloudflared": {Name: "cloudflared", Policy: updates.PolicyScheduled, Manageable: true, Source: sourceGitHub, Coord: "cloudflare/cloudflared"},
"velocity": {Name: "velocity", Policy: updates.PolicyNotify, Manageable: false, Source: sourcePaperMC, Coord: "velocity"},
}
got := Topology()
if len(got) != len(want) {
t.Fatalf("Topology has %d specs, want %d", len(got), len(want))
}
for _, s := range got {
w, ok := want[s.Name]
if !ok {
t.Errorf("unexpected component %q in topology", s.Name)
continue
}
if s != w {
t.Errorf("component %q = %+v, want %+v", s.Name, s, w)
}
}
}
// TestTopologyPinsMinecraft proves the pin is expressed as ABSENCE: no component in
// the static topology is Pinned, because Minecraft is never force-tracked here — it
// is appended from the live fleet at runtime. And nothing off-cluster is proposed for
// self-apply: velocity must be non-manageable (Notify at most, never Apply).
func TestTopologyPinsMinecraft(t *testing.T) {
for _, s := range Topology() {
if s.Policy == updates.PolicyPinned {
t.Errorf("component %q is Pinned in the static topology; Minecraft pins belong to the runtime fleet, not here", s.Name)
}
if s.Name == "velocity" && s.Manageable {
t.Error("velocity is off-cluster and must be non-manageable (Notify only)")
}
}
}