Initial Proxmox dashboard with host and guest metrics
This commit is contained in:
17
guests_test.go
Normal file
17
guests_test.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestGuestJSON(t *testing.T) {
|
||||
data := []byte(`{"vmid":101,"name":"test","type":"qemu","status":"running","cpu":0.25,"maxcpu":4,"mem":1024,"maxmem":4096,"uptime":60}`)
|
||||
var guest GuestMetrics
|
||||
if err := json.Unmarshal(data, &guest); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if guest.VMID != 101 || guest.CPU != 0.25 || guest.MaxCPU != 4 {
|
||||
t.Fatalf("неожиданные данные гостя: %+v", guest)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user