forked from cloudradar/frontman
-
Notifications
You must be signed in to change notification settings - Fork 0
/
servicecheck_test.go
49 lines (45 loc) · 1.08 KB
/
servicecheck_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
46
47
48
49
package frontman
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestDNSUDPCheck(t *testing.T) {
cfg, _ := HandleAllConfigSetup(DefaultCfgPath)
cfg.Sleep = 10
fm := helperCreateFrontman(t, cfg)
input := &Input{
ServiceChecks: []ServiceCheck{{
UUID: "dns-udp-check",
Check: ServiceCheckData{
Connect: "8.8.8.8",
Protocol: "udp",
Service: "dns",
Port: "53",
},
}},
}
fm.processInput(input.asChecks(), true)
res := <-fm.resultsChan
require.Equal(t, nil, res.Message)
require.Equal(t, 1, res.Measurements["net.udp.dns.53.success"])
}
func TestDNSTCPCheck(t *testing.T) {
cfg, _ := HandleAllConfigSetup(DefaultCfgPath)
cfg.Sleep = 10
fm := helperCreateFrontman(t, cfg)
input := &Input{
ServiceChecks: []ServiceCheck{{
UUID: "dns-tcp-check",
Check: ServiceCheckData{
Connect: "8.8.8.8",
Protocol: "tcp",
Service: "dns",
Port: "53",
},
}},
}
fm.processInput(input.asChecks(), true)
res := <-fm.resultsChan
require.Equal(t, nil, res.Message)
require.Equal(t, 1, res.Measurements["net.tcp.dns.53.success"])
}