container_network/crawler/health/dns/DNSHealthCrawler_test.go

33 lines
751 B
Go
Raw Normal View History

2018-04-19 15:46:38 +00:00
package dns
import (
"testing"
2018-07-05 09:58:08 +00:00
"git.loafle.net/overflow/commons-go/model/meta"
2018-04-26 08:50:26 +00:00
ocmsc "git.loafle.net/overflow/commons-go/model/sensorconfig"
2018-04-19 15:46:38 +00:00
"github.com/stretchr/testify/assert"
)
func TestMatch(t *testing.T) {
2018-04-26 08:50:26 +00:00
config := &ocmsc.SensorConfig{}
2018-07-05 09:58:08 +00:00
config.Connection = &ocmsc.SensorConfigConnection{
MetaIPTypeKey: "V4",
IP: "192.168.1.254",
MetaPortTypeKey: "UDP",
Port: "53",
2018-04-19 15:46:38 +00:00
}
2018-07-05 09:58:08 +00:00
metaCollectionItem := &meta.MetaCollectionItem{
Key: "dns.response_time",
}
config.MetaCollectionItems = make([]*meta.MetaCollectionItem, 1)
config.MetaCollectionItems[0] = metaCollectionItem
2018-04-19 15:46:38 +00:00
c := NewCrawler()
rss, err := c.Get(config)
2018-07-05 09:58:08 +00:00
if err != nil {
t.Log(err.Error())
}
assert.NotNil(t, rss["dns.response_time"])
2018-04-19 15:46:38 +00:00
}