feat: implement cross-platform metric collector with gopsutil, rename module to nexusrmm.local/agent
This commit is contained in:
19
Agent/internal/collector/collector_test.go
Normal file
19
Agent/internal/collector/collector_test.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package collector
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestCollect(t *testing.T) {
|
||||
metrics, err := Collect()
|
||||
if err != nil {
|
||||
t.Fatalf("Collect() error: %v", err)
|
||||
}
|
||||
if metrics.CPUPercent < 0 || metrics.CPUPercent > 100 {
|
||||
t.Errorf("CPU percent out of range: %f", metrics.CPUPercent)
|
||||
}
|
||||
if metrics.MemoryTotal == 0 {
|
||||
t.Error("MemoryTotal should not be 0")
|
||||
}
|
||||
if len(metrics.Disks) == 0 {
|
||||
t.Error("Expected at least one disk")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user