34 lines
718 B
Go
34 lines
718 B
Go
package cl_104
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/influxdata/telegraf/plugins/parsers/influx"
|
|
"github.com/influxdata/telegraf/testutil"
|
|
)
|
|
|
|
const (
|
|
testMsg = `{"ti":30,"cot":3,"ca":1,"infos":[{"ioa":121,"val":1,"q":0,"ms":1768205453000}]}`
|
|
badMsg = "blahblahblah: 42\n"
|
|
emptyMsg = ""
|
|
|
|
basicUsername = "test-username-please-ignore"
|
|
basicPassword = "super-secure-password!"
|
|
)
|
|
|
|
func newTestCL104() (*CL104, error) {
|
|
parser := &influx.Parser{}
|
|
if err := parser.Init(); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
listener := &CL104{
|
|
Log: testutil.Logger{},
|
|
ServiceAddress: "localhost:0",
|
|
Parser: parser,
|
|
timeFunc: time.Now,
|
|
close: make(chan struct{}),
|
|
}
|
|
return listener, nil
|
|
}
|