From a08c6cd92fecf6fb4c67785d0132b82157475dc7 Mon Sep 17 00:00:00 2001 From: Soulou Date: Mon, 19 Mar 2018 12:27:31 +0100 Subject: [PATCH] Update nsq inputs tests --- plugins/inputs/nsq/nsq.go | 12 ++++++++---- plugins/inputs/nsq/nsq_test.go | 10 ++++------ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/plugins/inputs/nsq/nsq.go b/plugins/inputs/nsq/nsq.go index 11399ffaa221c..e53c0ca04d078 100644 --- a/plugins/inputs/nsq/nsq.go +++ b/plugins/inputs/nsq/nsq.go @@ -68,13 +68,17 @@ const ( func init() { inputs.Add("nsq", func() telegraf.Input { - return &NSQ{ - httpClientOnce: &sync.Once{}, - tlsConfigOnce: &sync.Once{}, - } + return New() }) } +func New() *NSQ { + return &NSQ{ + httpClientOnce: &sync.Once{}, + tlsConfigOnce: &sync.Once{}, + } +} + func (n *NSQ) SampleConfig() string { return sampleConfig } diff --git a/plugins/inputs/nsq/nsq_test.go b/plugins/inputs/nsq/nsq_test.go index f3e9ce8689a64..1d3b541e5f1ce 100644 --- a/plugins/inputs/nsq/nsq_test.go +++ b/plugins/inputs/nsq/nsq_test.go @@ -19,9 +19,8 @@ func TestNSQStatsV1(t *testing.T) { })) defer ts.Close() - n := &NSQ{ - Endpoints: []string{ts.URL}, - } + n := New() + n.Endpoints = []string{ts.URL} var acc testutil.Accumulator err := acc.GatherError(n.Gather) @@ -276,9 +275,8 @@ func TestNSQStatsPreV1(t *testing.T) { })) defer ts.Close() - n := &NSQ{ - Endpoints: []string{ts.URL}, - } + n := New() + n.Endpoints = []string{ts.URL} var acc testutil.Accumulator err := acc.GatherError(n.Gather)