Skip to content

Commit

Permalink
Update nsq inputs tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Soulou committed Mar 19, 2018
1 parent eb4f1a2 commit a08c6cd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
12 changes: 8 additions & 4 deletions plugins/inputs/nsq/nsq.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
10 changes: 4 additions & 6 deletions plugins/inputs/nsq/nsq_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit a08c6cd

Please sign in to comment.