33 lines
751 B
Go
33 lines
751 B
Go
package dns
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"git.loafle.net/overflow/commons-go/model/meta"
|
|
ocmsc "git.loafle.net/overflow/commons-go/model/sensorconfig"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestMatch(t *testing.T) {
|
|
config := &ocmsc.SensorConfig{}
|
|
config.Connection = &ocmsc.SensorConfigConnection{
|
|
MetaIPTypeKey: "V4",
|
|
IP: "192.168.1.254",
|
|
MetaPortTypeKey: "UDP",
|
|
Port: "53",
|
|
}
|
|
metaCollectionItem := &meta.MetaCollectionItem{
|
|
Key: "dns.response_time",
|
|
}
|
|
config.MetaCollectionItems = make([]*meta.MetaCollectionItem, 1)
|
|
config.MetaCollectionItems[0] = metaCollectionItem
|
|
|
|
c := NewCrawler()
|
|
rss, err := c.Get(config)
|
|
|
|
if err != nil {
|
|
t.Log(err.Error())
|
|
}
|
|
assert.NotNil(t, rss["dns.response_time"])
|
|
}
|