[ Agent ] [ Status ] - refresh status part

This commit is contained in:
zeaslity
2023-12-20 15:50:08 +08:00
parent 3312052645
commit 4d56083b5a
15 changed files with 423 additions and 68 deletions

View File

@@ -20,3 +20,27 @@ func TestGetNetworkInfo(t *testing.T) {
fmt.Println(string(marshalIndent))
}
func TestMatchNetInterfaceRight(t *testing.T) {
interfaceNames := []string{"eth0", "eth1", "enp3s0", "wlan0", "lo", "ens12", "eno1", "asdas", "en0"}
for _, name := range interfaceNames {
if MatchNetInterfaceRight(name) {
t.Logf("匹配到的网卡名称: %s\n", name)
}
}
}
func TestGetNetworkMetric(t *testing.T) {
metric, err := GetNetworkMetric()
if err != nil {
t.Logf("get network metric error %s\n", err.Error())
}
for _, networkMetric := range metric {
fmt.Println()
bytes, _ := json.MarshalIndent(networkMetric, "", " ")
fmt.Println(string(bytes))
fmt.Println()
}
}