Skip to content

Commit 277fde5

Browse files
committed
Reorganized tests
1 parent 48fbc38 commit 277fde5

15 files changed

+136
-38
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,8 @@ jobs:
2424
with:
2525
go-version: '1.20'
2626

27-
- name: Test Package
28-
run: go test -v "./go-zabbix/.."
29-
30-
- name: Test Types Package
31-
run: go test -v "./types/..."
27+
- name: Test
28+
run: go test -v -short "./..."
3229

3330
integration:
3431
timeout-minutes: 31
@@ -90,7 +87,7 @@ jobs:
9087
run: docker compose -f "docker-compose.yml" logs server
9188

9289
- name: Test
93-
run: go test -v "./test/integration/..."
90+
run: go test -v -run Integration "./..."
9491

9592
- name: Stop containers
9693
if: always()

Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
tests: unittests integration
22

33
unittests:
4-
go test -v "./go-zabbix/.."
5-
go test -v "./types/..."
4+
go test -v -short "./..."
65

76
integration:
8-
go test -v "./test/integration/..."
7+
go test -v -run Integration "./..."

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@ func main() {
109109
Running the unit tests:
110110

111111
```bash
112-
go test -v "./go-zabbix/.."
113-
go test -v "./types/..."
112+
go test -v -short "./..."
114113
# or:
115114
make unittests
116115
```
@@ -124,7 +123,7 @@ export ZBX_VERSION=6.4
124123
docker compose up -d
125124
# server should be running in a minute
126125
# run tests:
127-
go test -v "./test/integration/..."
126+
go test -v -run Integration "./..."
128127
# or:
129128
make integration
130129
```

test/integration/action_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ import (
77
"github.com/fabiang/go-zabbix/test"
88
)
99

10-
func TestActions(t *testing.T) {
10+
func TestActionsIntegration(t *testing.T) {
11+
if testing.Short() {
12+
t.Skip()
13+
}
14+
1115
session := test.GetTestSession(t)
1216

1317
params := zabbix.ActionGetParams{}

test/integration/alert_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ import (
77
"github.com/fabiang/go-zabbix/test"
88
)
99

10-
func TestAlerts(t *testing.T) {
10+
func TestAlertsIntegration(t *testing.T) {
11+
if testing.Short() {
12+
t.Skip()
13+
}
14+
1115
session := test.GetTestSession(t)
1216

1317
params := zabbix.AlertGetParams{

test/integration/event_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ import (
77
"github.com/fabiang/go-zabbix/test"
88
)
99

10-
func TestEvents(t *testing.T) {
10+
func TestEventsIntegration(t *testing.T) {
11+
if testing.Short() {
12+
t.Skip()
13+
}
14+
1115
session := test.GetTestSession(t)
1216

1317
params := zabbix.EventGetParams{

test/integration/history_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ import (
77
"github.com/fabiang/go-zabbix/test"
88
)
99

10-
func TestHistories(t *testing.T) {
10+
func TestHistoriesIntegration(t *testing.T) {
11+
if testing.Short() {
12+
t.Skip()
13+
}
14+
1115
session := test.GetTestSession(t)
1216

1317
params := zabbix.HistoryGetParams{}

test/integration/host_interface_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ import (
77
"github.com/fabiang/go-zabbix/test"
88
)
99

10-
func TestHostInterfaces(t *testing.T) {
10+
func TestHostInterfacesIntegration(t *testing.T) {
11+
if testing.Short() {
12+
t.Skip()
13+
}
14+
1115
session := test.GetTestSession(t)
1216

1317
params := zabbix.HostInterfaceGetParams{}

test/integration/hostgroups_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ import (
77
"github.com/fabiang/go-zabbix/test"
88
)
99

10-
func TestHostgroups(t *testing.T) {
10+
func TestHostgroupsIntegration(t *testing.T) {
11+
if testing.Short() {
12+
t.Skip()
13+
}
14+
1115
session := test.GetTestSession(t)
1216

1317
params := zabbix.HostgroupGetParams{}

test/integration/hosts_test.go

Lines changed: 74 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,31 +30,47 @@ func testHost(t *testing.T, params zabbix.HostGetParams) {
3030
t.Logf("Validated %d Hosts", len(hosts))
3131
}
3232

33-
func TestHostsTemplates(t *testing.T) {
33+
func TestHostsTemplatesIntegration(t *testing.T) {
34+
if testing.Short() {
35+
t.Skip()
36+
}
37+
3438
params := zabbix.HostGetParams{
3539
IncludeTemplates: true,
3640
}
3741

3842
testHost(t, params)
3943
}
4044

41-
func TestHostsGroups(t *testing.T) {
45+
func TestHostsGroupsIntegration(t *testing.T) {
46+
if testing.Short() {
47+
t.Skip()
48+
}
49+
4250
params := zabbix.HostGetParams{
4351
SelectGroups: zabbix.SelectExtendedOutput,
4452
}
4553

4654
testHost(t, params)
4755
}
4856

49-
func TestHostsApplications(t *testing.T) {
57+
func TestHostsApplicationsIntegration(t *testing.T) {
58+
if testing.Short() {
59+
t.Skip()
60+
}
61+
5062
params := zabbix.HostGetParams{
5163
SelectApplications: zabbix.SelectExtendedOutput,
5264
}
5365

5466
testHost(t, params)
5567
}
5668

57-
func TestHostsDiscoveries(t *testing.T) {
69+
func TestHostsDiscoveriesIntegration(t *testing.T) {
70+
if testing.Short() {
71+
t.Skip()
72+
}
73+
5874
params := zabbix.HostGetParams{
5975
SelectDiscoveries: zabbix.SelectExtendedOutput,
6076
}
@@ -63,7 +79,10 @@ func TestHostsDiscoveries(t *testing.T) {
6379

6480
}
6581

66-
func TestHostsDiscoveryRule(t *testing.T) {
82+
func TestHostsDiscoveryRuleIntegration(t *testing.T) {
83+
if testing.Short() {
84+
t.Skip()
85+
}
6786

6887
params := zabbix.HostGetParams{
6988
SelectDiscoveryRule: zabbix.SelectExtendedOutput,
@@ -72,79 +91,119 @@ func TestHostsDiscoveryRule(t *testing.T) {
7291
testHost(t, params)
7392
}
7493

75-
func TestHostsGraphs(t *testing.T) {
94+
func TestHostsGraphsIntegration(t *testing.T) {
95+
if testing.Short() {
96+
t.Skip()
97+
}
98+
7699
params := zabbix.HostGetParams{
77100
SelectGraphs: zabbix.SelectExtendedOutput,
78101
}
79102

80103
testHost(t, params)
81104
}
82105

83-
func TestHostsHostDiscovery(t *testing.T) {
106+
func TestHostsHostDiscoveryIntegration(t *testing.T) {
107+
if testing.Short() {
108+
t.Skip()
109+
}
110+
84111
params := zabbix.HostGetParams{
85112
SelectHostDiscovery: zabbix.SelectExtendedOutput,
86113
}
87114

88115
testHost(t, params)
89116
}
90117

91-
func TestHostsWebScenarios(t *testing.T) {
118+
func TestHostsWebScenariosIntegration(t *testing.T) {
119+
if testing.Short() {
120+
t.Skip()
121+
}
122+
92123
params := zabbix.HostGetParams{
93124
SelectWebScenarios: zabbix.SelectExtendedOutput,
94125
}
95126

96127
testHost(t, params)
97128
}
98129

99-
func TestHostsInterfaces(t *testing.T) {
130+
func TestHostsInterfacesIntegration(t *testing.T) {
131+
if testing.Short() {
132+
t.Skip()
133+
}
134+
100135
params := zabbix.HostGetParams{
101136
SelectInterfaces: zabbix.SelectExtendedOutput,
102137
}
103138

104139
testHost(t, params)
105140
}
106141

107-
func TestHostsInventory(t *testing.T) {
142+
func TestHostsInventoryIntegration(t *testing.T) {
143+
if testing.Short() {
144+
t.Skip()
145+
}
146+
108147
params := zabbix.HostGetParams{
109148
SelectInventory: zabbix.SelectExtendedOutput,
110149
}
111150

112151
testHost(t, params)
113152
}
114153

115-
func TestHostsItems(t *testing.T) {
154+
func TestHostsItemsIntegration(t *testing.T) {
155+
if testing.Short() {
156+
t.Skip()
157+
}
158+
116159
params := zabbix.HostGetParams{
117160
SelectItems: zabbix.SelectExtendedOutput,
118161
}
119162

120163
testHost(t, params)
121164
}
122165

123-
func TestHostsMacros(t *testing.T) {
166+
func TestHostsMacrosIntegration(t *testing.T) {
167+
if testing.Short() {
168+
t.Skip()
169+
}
170+
124171
params := zabbix.HostGetParams{
125172
SelectMacros: zabbix.SelectExtendedOutput,
126173
}
127174

128175
testHost(t, params)
129176
}
130177

131-
func TestHostsParentTemplates(t *testing.T) {
178+
func TestHostsParentTemplatesIntegration(t *testing.T) {
179+
if testing.Short() {
180+
t.Skip()
181+
}
182+
132183
params := zabbix.HostGetParams{
133184
SelectParentTemplates: zabbix.SelectExtendedOutput,
134185
}
135186

136187
testHost(t, params)
137188
}
138189

139-
func TestHostsScreens(t *testing.T) {
190+
func TestHostsScreensIntegration(t *testing.T) {
191+
if testing.Short() {
192+
t.Skip()
193+
}
194+
140195
params := zabbix.HostGetParams{
141196
SelectScreens: zabbix.SelectExtendedOutput,
142197
}
143198

144199
testHost(t, params)
145200
}
146201

147-
func TestHostsTriggers(t *testing.T) {
202+
func TestHostsTriggersIntegration(t *testing.T) {
203+
if testing.Short() {
204+
t.Skip()
205+
}
206+
148207
params := zabbix.HostGetParams{
149208
SelectTriggers: zabbix.SelectExtendedOutput,
150209
}

test/integration/items_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ import (
77
"github.com/fabiang/go-zabbix/test"
88
)
99

10-
func TestItems(t *testing.T) {
10+
func TestItemsIntegration(t *testing.T) {
11+
if testing.Short() {
12+
t.Skip()
13+
}
14+
1115
session := test.GetTestSession(t)
1216

1317
params := zabbix.ItemGetParams{}

test/integration/maintenance_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ import (
77
"github.com/fabiang/go-zabbix/test"
88
)
99

10-
func TestMaintenance(t *testing.T) {
10+
func TestMaintenanceIntegration(t *testing.T) {
11+
if testing.Short() {
12+
t.Skip()
13+
}
14+
1115
session := test.GetTestSession(t)
1216

1317
params := zabbix.MaintenanceGetParams{}

test/integration/proxy_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ import (
77
"github.com/fabiang/go-zabbix/test"
88
)
99

10-
func TestProxy(t *testing.T) {
10+
func TestProxyIntegration(t *testing.T) {
11+
if testing.Short() {
12+
t.Skip()
13+
}
14+
1115
session := test.GetTestSession(t)
1216

1317
params := zabbix.ProxyGetParams{}

test/integration/trigger_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ import (
77
"github.com/fabiang/go-zabbix/test"
88
)
99

10-
func TestTriggers(t *testing.T) {
10+
func TestTriggersIntegration(t *testing.T) {
11+
if testing.Short() {
12+
t.Skip()
13+
}
14+
1115
session := test.GetTestSession(t)
1216

1317
params := zabbix.TriggerGetParams{}

test/integration/usermacros_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ import (
77
"github.com/fabiang/go-zabbix/test"
88
)
99

10-
func TestUserMacros(t *testing.T) {
10+
func TestUserMacrosIntegration(t *testing.T) {
11+
if testing.Short() {
12+
t.Skip()
13+
}
14+
1115
session := test.GetTestSession(t)
1216

1317
params := zabbix.UserMacroGetParams{}

0 commit comments

Comments
 (0)