From a941779ea8e27750f3597688513e83d0d1f5988b Mon Sep 17 00:00:00 2001 From: Daniel Nelson Date: Thu, 25 Jul 2019 17:36:46 -0700 Subject: [PATCH] Call Init before Start in test mode (#6171) --- agent/agent.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/agent/agent.go b/agent/agent.go index 542154388..aa3e32a43 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -182,6 +182,12 @@ func (a *Agent) Test(ctx context.Context, waitDuration time.Duration) error { } } + log.Printf("D! [agent] Initializing plugins") + err := a.initPlugins() + if err != nil { + return err + } + if hasServiceInputs { log.Printf("D! [agent] Starting service inputs") err := a.startServiceInputs(ctx, metricC) @@ -191,11 +197,6 @@ func (a *Agent) Test(ctx context.Context, waitDuration time.Duration) error { } for _, input := range a.Config.Inputs { - err := input.Init() - if err != nil { - return err - } - select { case <-ctx.Done(): return nil