test(agent): 遥测 AgentVersion 断言对齐第18条 A 系口径
This commit is contained in:
@@ -58,13 +58,14 @@ func TestChooseHostIPs(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TestCollectTelemetryShape pins the always-on fields on any Linux host:
|
// TestCollectTelemetryShape pins the always-on fields on any Linux host:
|
||||||
// the agent's own build version and a positive host uptime. Source-specific
|
// the agent's own A-series display version (item 18) and a positive host
|
||||||
// fields (xray version, IPs) are environment-dependent and not asserted.
|
// uptime. Source-specific fields (xray version, IPs) are
|
||||||
|
// environment-dependent and not asserted.
|
||||||
func TestCollectTelemetryShape(t *testing.T) {
|
func TestCollectTelemetryShape(t *testing.T) {
|
||||||
a := New(&Config{MasterURL: "http://127.0.0.1:1", Token: "t", NodeName: "n"})
|
a := New(&Config{MasterURL: "http://127.0.0.1:1", Token: "t", NodeName: "n"})
|
||||||
tel := a.collectTelemetry()
|
tel := a.collectTelemetry()
|
||||||
if tel.AgentVersion != config.GetBaseVersion() || tel.AgentVersion == "" {
|
if tel.AgentVersion != config.GetAgentDisplayVersion() || tel.AgentVersion == "" {
|
||||||
t.Errorf("AgentVersion = %q, want config.GetBaseVersion() %q", tel.AgentVersion, config.GetBaseVersion())
|
t.Errorf("AgentVersion = %q, want config.GetAgentDisplayVersion() %q", tel.AgentVersion, config.GetAgentDisplayVersion())
|
||||||
}
|
}
|
||||||
if tel.UptimeSeconds == nil || *tel.UptimeSeconds == 0 {
|
if tel.UptimeSeconds == nil || *tel.UptimeSeconds == 0 {
|
||||||
t.Errorf("UptimeSeconds = %v, want non-nil positive", tel.UptimeSeconds)
|
t.Errorf("UptimeSeconds = %v, want non-nil positive", tel.UptimeSeconds)
|
||||||
|
|||||||
Reference in New Issue
Block a user