Call Init before Start in test mode (#6171)

This commit is contained in:
Daniel Nelson 2019-07-25 17:36:46 -07:00 committed by GitHub
parent 785b76d3d1
commit a941779ea8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

View File

@ -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 { if hasServiceInputs {
log.Printf("D! [agent] Starting service inputs") log.Printf("D! [agent] Starting service inputs")
err := a.startServiceInputs(ctx, metricC) 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 { for _, input := range a.Config.Inputs {
err := input.Init()
if err != nil {
return err
}
select { select {
case <-ctx.Done(): case <-ctx.Done():
return nil return nil