test(agent): 遥测 AgentVersion 断言对齐第18条 A 系口径

This commit is contained in:
Muse
2026-10-22 13:12:14 +00:00
parent 29b724dae1
commit f18aca9410
+5 -4
View File
@@ -58,13 +58,14 @@ func TestChooseHostIPs(t *testing.T) {
}
// TestCollectTelemetryShape pins the always-on fields on any Linux host:
// the agent's own build version and a positive host uptime. Source-specific
// fields (xray version, IPs) are environment-dependent and not asserted.
// the agent's own A-series display version (item 18) and a positive host
// uptime. Source-specific fields (xray version, IPs) are
// environment-dependent and not asserted.
func TestCollectTelemetryShape(t *testing.T) {
a := New(&Config{MasterURL: "http://127.0.0.1:1", Token: "t", NodeName: "n"})
tel := a.collectTelemetry()
if tel.AgentVersion != config.GetBaseVersion() || tel.AgentVersion == "" {
t.Errorf("AgentVersion = %q, want config.GetBaseVersion() %q", tel.AgentVersion, config.GetBaseVersion())
if tel.AgentVersion != config.GetAgentDisplayVersion() || tel.AgentVersion == "" {
t.Errorf("AgentVersion = %q, want config.GetAgentDisplayVersion() %q", tel.AgentVersion, config.GetAgentDisplayVersion())
}
if tel.UptimeSeconds == nil || *tel.UptimeSeconds == 0 {
t.Errorf("UptimeSeconds = %v, want non-nil positive", tel.UptimeSeconds)