From fb4a272a45b2e8802f1f5fb1a9d57fe1bd9b0769 Mon Sep 17 00:00:00 2001 From: Max U Date: Mon, 25 Jun 2018 15:52:43 -0700 Subject: [PATCH] allow for import from plugins/all --- plugins/inputs/all/all.go | 1 + plugins/inputs/reader/reader_test.go | 17 ++++++----------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/plugins/inputs/all/all.go b/plugins/inputs/all/all.go index de34847d6..fc38b70f5 100644 --- a/plugins/inputs/all/all.go +++ b/plugins/inputs/all/all.go @@ -86,6 +86,7 @@ import ( _ "github.com/influxdata/telegraf/plugins/inputs/rabbitmq" _ "github.com/influxdata/telegraf/plugins/inputs/raindrops" _ "github.com/influxdata/telegraf/plugins/inputs/reader" + _ "github.com/influxdata/telegraf/plugins/inputs/redis" _ "github.com/influxdata/telegraf/plugins/inputs/rethinkdb" _ "github.com/influxdata/telegraf/plugins/inputs/riak" _ "github.com/influxdata/telegraf/plugins/inputs/salesforce" diff --git a/plugins/inputs/reader/reader_test.go b/plugins/inputs/reader/reader_test.go index dcfa9ffc3..ca076350b 100644 --- a/plugins/inputs/reader/reader_test.go +++ b/plugins/inputs/reader/reader_test.go @@ -25,13 +25,11 @@ func TestJSONParserCompile(t *testing.T) { testDir := getPluginDir() var acc testutil.Accumulator r := Reader{ - Filepaths: []string{testDir + "/reader/testfiles/json_a.log"}, - DataFormat: "json", - Tags: []string{"parent_ignored_child"}, + Filepaths: []string{testDir + "/reader/testfiles/json_a.log"}, } parserConfig := parsers.Config{ - DataFormat: r.DataFormat, - TagKeys: r.Tags, + DataFormat: "json", + TagKeys: []string{"parent_ignored_child"}, } nParser, err := parsers.NewParser(&parserConfig) r.parser = nParser @@ -47,14 +45,12 @@ func TestGrokParser(t *testing.T) { testDir := getPluginDir() var acc testutil.Accumulator r := Reader{ - Filepaths: []string{testDir + "/reader/testfiles/grok_a.log"}, - DataFormat: "grok", + Filepaths: []string{testDir + "/reader/testfiles/grok_a.log"}, } parserConfig := parsers.Config{ - DataFormat: r.DataFormat, - TagKeys: r.Tags, - Patterns: []string{"{%COMMON-LOG-FORMAT}"}, + DataFormat: "grok", + Patterns: []string{"%{COMMON_LOG_FORMAT}"}, } nParser, err := parsers.NewParser(&parserConfig) @@ -67,7 +63,6 @@ func TestGrokParser(t *testing.T) { log.Printf("metric[0]_tags: %v, metric[0]_fields: %v", acc.Metrics[0].Tags, acc.Metrics[0].Fields) log.Printf("metric[1]_tags: %v, metric[1]_fields: %v", acc.Metrics[1].Tags, acc.Metrics[1].Fields) assert.Equal(t, 2, len(acc.Metrics)) - t.Error() } func getPluginDir() string {