-
Notifications
You must be signed in to change notification settings - Fork 71
/
hosts_test.go
44 lines (37 loc) · 1.13 KB
/
hosts_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
package zabbix
import (
"testing"
)
func TestHosts(t *testing.T) {
session := GetTestSession(t)
params := HostGetParams{
IncludeTemplates: true,
SelectGroups: SelectExtendedOutput,
SelectApplications: SelectExtendedOutput,
SelectDiscoveries: SelectExtendedOutput,
SelectDiscoveryRule: SelectExtendedOutput,
SelectGraphs: SelectExtendedOutput,
SelectHostDiscovery: SelectExtendedOutput,
SelectWebScenarios: SelectExtendedOutput,
SelectInterfaces: SelectExtendedOutput,
SelectInventory: SelectExtendedOutput,
SelectItems: SelectExtendedOutput,
SelectMacros: SelectExtendedOutput,
SelectParentTemplates: SelectExtendedOutput,
SelectScreens: SelectExtendedOutput,
SelectTriggers: SelectExtendedOutput,
}
hosts, err := session.GetHosts(params)
if err != nil {
t.Fatalf("Error getting Hosts: %v", err)
}
if len(hosts) == 0 {
t.Fatal("No Hosts found")
}
for i, host := range hosts {
if host.HostID == "" {
t.Fatalf("Host %d returned in response body has no Host ID", i)
}
}
t.Logf("Validated %d Hosts", len(hosts))
}