forked from zabbix-tools/go-zabbix
-
Notifications
You must be signed in to change notification settings - Fork 2
/
hostinterfaces_test.go
45 lines (38 loc) · 1.17 KB
/
hostinterfaces_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package zabbix
import (
"testing"
)
func TestHostinterfaces(t *testing.T) {
session := GetTestSession(t)
params := HostinterfaceGetParams{}
hostinterfaces, err := session.GetHostinterfaces(params)
if err != nil {
t.Fatalf("Error getting hostinterfaces: %v", err)
}
if len(hostinterfaces) == 0 {
t.Fatalf("No hostinterfaces found")
}
for i, hostinterface := range hostinterfaces {
if hostinterface.HostID == "" {
t.Fatalf("Hostinterface %d returned in response body has no HostID", i)
}
if hostinterface.InterfaceID == "" {
t.Fatalf("Hostinterface %d returned in response body has no InterfaceID", i)
}
switch hostinterface.Main {
case 0, 1:
default:
t.Fatalf("Hostinterface %d returned in response body has invalid Hostinterface Main value: %v", i, hostinterface.Main)
}
switch hostinterface.Type {
case 0, 1, 2, 3, 4:
default:
t.Fatalf("Hostinterface %d returned in response body has invalid Hostinterface Type value: %v", i, hostinterface.Type)
}
switch hostinterface.Useip {
case 0, 1:
default:
t.Fatalf("Hostinterface %d returned in response body has invalid Hostinterface Useip value: %v", i, hostinterface.Useip)
}
}
}