docs(agent): 统一中文注释并补充部署文档

将代码与测试注释改为中文以符合仓库规范;新增中文部署指南、
示例配置,并完善构建脚本对 VERSION 注入的说明。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
codex
2026-05-19 02:30:49 +00:00
parent 89d5e27874
commit 877e4cf41d
28 changed files with 608 additions and 226 deletions

View File

@@ -10,7 +10,7 @@ import (
"mfd-monitor-agent/internal/status"
)
// TestStatusReturnsCachedSnapshot verifies /status reads the provider cache.
// TestStatusReturnsCachedSnapshot 验证 /status 读取提供者缓存。
func TestStatusReturnsCachedSnapshot(t *testing.T) {
provider := StaticProvider{Snapshot: status.HostStatus{
Agent: status.AgentInfo{Version: "test", SnapshotAt: time.Now(), SnapshotStatus: "ok"},
@@ -34,7 +34,7 @@ func TestStatusReturnsCachedSnapshot(t *testing.T) {
}
}
// TestHealthReportsSnapshotMetadata verifies /health returns snapshot metadata.
// TestHealthReportsSnapshotMetadata 验证 /health 返回快照元数据。
func TestHealthReportsSnapshotMetadata(t *testing.T) {
provider := StaticProvider{Snapshot: status.HostStatus{
Agent: status.AgentInfo{Version: "test", SnapshotAt: time.Unix(10, 0), SnapshotStatus: "partial"},
@@ -57,7 +57,7 @@ func TestHealthReportsSnapshotMetadata(t *testing.T) {
}
}
// TestStatusReturnsServiceUnavailableBeforeSnapshot verifies /status does not live collect.
// TestStatusReturnsServiceUnavailableBeforeSnapshot 验证 /status 不会在请求时实时采集。
func TestStatusReturnsServiceUnavailableBeforeSnapshot(t *testing.T) {
server := New(StaticProvider{OK: false})
@@ -70,7 +70,7 @@ func TestStatusReturnsServiceUnavailableBeforeSnapshot(t *testing.T) {
}
}
// TestHealthReturnsStartingBeforeSnapshot verifies /health exposes startup state.
// TestHealthReturnsStartingBeforeSnapshot 验证 /health 在启动阶段暴露 starting 状态。
func TestHealthReturnsStartingBeforeSnapshot(t *testing.T) {
server := New(StaticProvider{OK: false})
@@ -90,7 +90,7 @@ func TestHealthReturnsStartingBeforeSnapshot(t *testing.T) {
}
}
// TestStatusRejectsNonGET verifies /status only accepts GET requests.
// TestStatusRejectsNonGET 验证 /status 仅接受 GET 请求。
func TestStatusRejectsNonGET(t *testing.T) {
server := New(StaticProvider{OK: true})
@@ -103,7 +103,7 @@ func TestStatusRejectsNonGET(t *testing.T) {
}
}
// TestHealthRejectsNonGET verifies /health only accepts GET requests.
// TestHealthRejectsNonGET 验证 /health 仅接受 GET 请求。
func TestHealthRejectsNonGET(t *testing.T) {
server := New(StaticProvider{OK: true})