Agent display version now comes from the agent line's own source (config.agentDisplayVersion injection + defaultAgentDisplayVersion constant, currently A2.3.0) instead of being derived from the panel's displayVersion. Masters resolve the agent line's latest from each release's agent-version.txt marker (selfupdate.ResolveLatestAgentTarget, legacy tag derivation as fallback for pre-marker releases): update intents target the marker under the panel tag, panel-only releases produce no intent, and the nodes page badges agent rows against their own line via PanelUpdateInfo.displayLatestAgentVersion. Windows agent frozen at A2.2.1: release discipline in docs/release.md + scripts/release-build.sh (agent assets reused verbatim when the agent code is unchanged, marker always emitted, no Windows exe), install-agent.ps1 pinned at V2.4.0, and the A2.2.1 protocol shapes locked by TestAgentLegacyWindows221Contract. Agent update tests now derive their targets from the live agent line instead of a hardcoded A2.0.x the line has passed.
46 lines
1.9 KiB
Go
46 lines
1.9 KiB
Go
package config
|
|
|
|
import "testing"
|
|
|
|
// Version-line decoupling: the agent's display version comes ONLY from
|
|
// the agent line's own injection (agentDisplayVersion), never from the
|
|
// panel's displayVersion. These tests lock that independence: moving
|
|
// either injection moves exactly one line's self-report.
|
|
func TestAgentDisplayVersionIndependentSource(t *testing.T) {
|
|
origPanel, origAgent := displayVersion, agentDisplayVersion
|
|
t.Cleanup(func() { displayVersion, agentDisplayVersion = origPanel, origAgent })
|
|
|
|
// Agent injection in bare and A-forms both normalize to the A-form.
|
|
for _, injected := range []string{"2.4.0", "A2.4.0", "a2.4.0"} {
|
|
agentDisplayVersion = injected
|
|
if got := GetAgentDisplayVersion(); got != "A2.4.0" {
|
|
t.Fatalf("agentDisplayVersion=%q: GetAgentDisplayVersion = %q, want A2.4.0", injected, got)
|
|
}
|
|
}
|
|
|
|
// Sweeping the panel injection across values must leave the agent
|
|
// self-report bit-identical (the phantom-update regression shape:
|
|
// a panel-only release used to drag every agent's version along).
|
|
agentDisplayVersion = "2.3.0"
|
|
for _, panel := range []string{"", "2.0.0", "2.4.0", "V2.4.0", "9.9.9"} {
|
|
displayVersion = panel
|
|
if got := GetAgentDisplayVersion(); got != "A2.3.0" {
|
|
t.Fatalf("displayVersion=%q moved the agent version: got %q, want A2.3.0", panel, got)
|
|
}
|
|
if got := GetMasterDisplayVersion(); panel != "" && got == "V2.3.0" {
|
|
t.Fatalf("displayVersion=%q: master version collided with the agent line: %q", panel, got)
|
|
}
|
|
}
|
|
|
|
// And the reverse: moving the agent injection must not move the
|
|
// master's self-report.
|
|
displayVersion = "2.4.0"
|
|
agentDisplayVersion = "2.5.0"
|
|
if got := GetMasterDisplayVersion(); got != "V2.4.0" {
|
|
t.Fatalf("agent injection moved the master version: got %q, want V2.4.0", got)
|
|
}
|
|
if got := GetAgentDisplayVersion(); got != "A2.5.0" {
|
|
t.Fatalf("agent self-report = %q, want A2.5.0", got)
|
|
}
|
|
}
|