mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-06-08 15:39:51 +08:00
- 新增 JMX/Endpoint/Agent 三种 JVM 连接模式与配置归一化链路 - 支持资源浏览、变更预览、写入应用、审计记录与只读约束 - 接入 AI 结构化写入计划与诊断计划回填能力 - 新增 Agent Bridge、Arthas Tunnel、JMX Helper 诊断传输实现 - 增加诊断控制台、命令模板、输出历史与自动补全交互 - 补齐前后端契约、运行夹具与 JVM 相关回归测试
38 lines
962 B
Go
38 lines
962 B
Go
package jvm
|
|
|
|
import (
|
|
"path/filepath"
|
|
"testing"
|
|
)
|
|
|
|
func TestDiagnosticAuditStoreAppendAndList(t *testing.T) {
|
|
store := NewDiagnosticAuditStore(filepath.Join(t.TempDir(), "diagnostic_audit.jsonl"))
|
|
|
|
err := store.Append(DiagnosticAuditRecord{
|
|
ConnectionID: "conn-orders",
|
|
Transport: DiagnosticTransportAgentBridge,
|
|
SessionID: "sess-1",
|
|
CommandID: "cmd-1",
|
|
Command: "thread -n 5",
|
|
CommandType: DiagnosticCommandCategoryObserve,
|
|
RiskLevel: "low",
|
|
Status: "completed",
|
|
Reason: "排查线程堆积",
|
|
})
|
|
if err != nil {
|
|
t.Fatalf("Append returned error: %v", err)
|
|
}
|
|
|
|
records, err := store.List("conn-orders", 10)
|
|
if err != nil {
|
|
t.Fatalf("List returned error: %v", err)
|
|
}
|
|
if len(records) != 1 {
|
|
t.Fatalf("expected 1 record, got %#v", records)
|
|
}
|
|
record := records[0]
|
|
if record.Command != "thread -n 5" || record.Status != "completed" {
|
|
t.Fatalf("unexpected diagnostic audit record: %#v", record)
|
|
}
|
|
}
|