Call Init before Start in test mode (#6171)
This commit is contained in:
parent
785b76d3d1
commit
a941779ea8
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue