allow for import from plugins/all

This commit is contained in:
Max U 2018-06-25 15:52:43 -07:00
parent 9c845950a7
commit cc406299ba
2 changed files with 7 additions and 11 deletions

View File

@ -86,6 +86,7 @@ import (
_ "github.com/influxdata/telegraf/plugins/inputs/rabbitmq" _ "github.com/influxdata/telegraf/plugins/inputs/rabbitmq"
_ "github.com/influxdata/telegraf/plugins/inputs/raindrops" _ "github.com/influxdata/telegraf/plugins/inputs/raindrops"
_ "github.com/influxdata/telegraf/plugins/inputs/reader" _ "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/rethinkdb"
_ "github.com/influxdata/telegraf/plugins/inputs/riak" _ "github.com/influxdata/telegraf/plugins/inputs/riak"
_ "github.com/influxdata/telegraf/plugins/inputs/salesforce" _ "github.com/influxdata/telegraf/plugins/inputs/salesforce"

View File

@ -25,13 +25,11 @@ func TestJSONParserCompile(t *testing.T) {
testDir := getPluginDir() testDir := getPluginDir()
var acc testutil.Accumulator var acc testutil.Accumulator
r := Reader{ r := Reader{
Filepaths: []string{testDir + "/reader/testfiles/json_a.log"}, Filepaths: []string{testDir + "/reader/testfiles/json_a.log"},
DataFormat: "json",
Tags: []string{"parent_ignored_child"},
} }
parserConfig := parsers.Config{ parserConfig := parsers.Config{
DataFormat: r.DataFormat, DataFormat: "json",
TagKeys: r.Tags, TagKeys: []string{"parent_ignored_child"},
} }
nParser, err := parsers.NewParser(&parserConfig) nParser, err := parsers.NewParser(&parserConfig)
r.parser = nParser r.parser = nParser
@ -47,14 +45,12 @@ func TestGrokParser(t *testing.T) {
testDir := getPluginDir() testDir := getPluginDir()
var acc testutil.Accumulator var acc testutil.Accumulator
r := Reader{ r := Reader{
Filepaths: []string{testDir + "/reader/testfiles/grok_a.log"}, Filepaths: []string{testDir + "/reader/testfiles/grok_a.log"},
DataFormat: "grok",
} }
parserConfig := parsers.Config{ parserConfig := parsers.Config{
DataFormat: r.DataFormat, DataFormat: "grok",
TagKeys: r.Tags, Patterns: []string{"%{COMMON_LOG_FORMAT}"},
Patterns: []string{"{%COMMON-LOG-FORMAT}"},
} }
nParser, err := parsers.NewParser(&parserConfig) 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[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) 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)) assert.Equal(t, 2, len(acc.Metrics))
t.Error()
} }
func getPluginDir() string { func getPluginDir() string {