Fix unit tests for new metric implementation
This commit is contained in:
@@ -156,7 +156,7 @@ func (i *Instrumental) Write(metrics []telegraf.Metric) error {
|
||||
}
|
||||
}
|
||||
|
||||
allPoints := strings.Join(points, "\n") + "\n"
|
||||
allPoints := strings.Join(points, "")
|
||||
_, err = fmt.Fprintf(i.conn, allPoints)
|
||||
|
||||
if err != nil {
|
||||
|
||||
@@ -17,7 +17,7 @@ func TestFormatMetric(t *testing.T) {
|
||||
|
||||
p := testutil.MockMetrics()[0]
|
||||
|
||||
valid_string := "test1,tag1=value1 value=1 1257894000000000000"
|
||||
valid_string := "test1,tag1=value1 value=1 1257894000000000000\n"
|
||||
func_string, err := FormatMetric(k, p)
|
||||
|
||||
if func_string != valid_string {
|
||||
@@ -29,7 +29,7 @@ func TestFormatMetric(t *testing.T) {
|
||||
Format: "custom",
|
||||
}
|
||||
|
||||
valid_custom := "test1,map[tag1:value1],test1,tag1=value1 value=1 1257894000000000000"
|
||||
valid_custom := "test1,map[tag1:value1],test1,tag1=value1 value=1 1257894000000000000\n"
|
||||
func_custom, err := FormatMetric(k, p)
|
||||
|
||||
if func_custom != valid_custom {
|
||||
|
||||
@@ -163,14 +163,14 @@ func TestBuildGauge(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func newHostMetric(value interface{}, name, host string) (metric telegraf.Metric) {
|
||||
metric, _ = metric.New(
|
||||
func newHostMetric(value interface{}, name, host string) telegraf.Metric {
|
||||
m, _ := metric.New(
|
||||
name,
|
||||
map[string]string{"host": host},
|
||||
map[string]interface{}{"value": value},
|
||||
time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC),
|
||||
)
|
||||
return
|
||||
return m
|
||||
}
|
||||
|
||||
func TestBuildGaugeWithSource(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user