diff --git a/x-pack/elastic-agent/pkg/agent/operation/operator_test.go b/x-pack/elastic-agent/pkg/agent/operation/operator_test.go index b393ee2c6c55..8966ca9a516b 100644 --- a/x-pack/elastic-agent/pkg/agent/operation/operator_test.go +++ b/x-pack/elastic-agent/pkg/agent/operation/operator_test.go @@ -139,9 +139,6 @@ func TestConfigurableRun(t *testing.T) { } func TestConfigurableFailed(t *testing.T) { - if runtime.GOOS == "windows" { - t.Skip("this test is sometimes flaky on the last part, investigating @michal") - } p := getProgram("configurable", "1.0") operator := getTestOperator(t, downloadPath, installPath, p) diff --git a/x-pack/elastic-agent/pkg/core/plugin/process/start.go b/x-pack/elastic-agent/pkg/core/plugin/process/start.go index 204c3747a99c..f87c439c011b 100644 --- a/x-pack/elastic-agent/pkg/core/plugin/process/start.go +++ b/x-pack/elastic-agent/pkg/core/plugin/process/start.go @@ -56,7 +56,7 @@ func (a *Application) start(ctx context.Context, t app.Taggable, cfg map[string] if srvState != nil { a.setState(state.Starting, "Starting", nil) srvState.SetStatus(proto.StateObserved_STARTING, a.state.Message, a.state.Payload) - srvState.UpdateConfig(string(cfgStr)) + srvState.UpdateConfig(srvState.Config()) } else { a.srvState, err = a.srv.Register(a, string(cfgStr)) if err != nil { diff --git a/x-pack/elastic-agent/pkg/core/plugin/process/status.go b/x-pack/elastic-agent/pkg/core/plugin/process/status.go index 6838c0a18d47..02c38d6b82d3 100644 --- a/x-pack/elastic-agent/pkg/core/plugin/process/status.go +++ b/x-pack/elastic-agent/pkg/core/plugin/process/status.go @@ -74,7 +74,7 @@ func (a *Application) startFailedTimer(cfg map[string]interface{}) { case <-ctx.Done(): return case <-t.C: - a.restart(a.restartConfig) + a.restart() } }() } @@ -91,7 +91,7 @@ func (a *Application) stopFailedTimer() { } // restart restarts the application -func (a *Application) restart(cfg map[string]interface{}) { +func (a *Application) restart() { a.appLock.Lock() defer a.appLock.Unlock() @@ -103,7 +103,7 @@ func (a *Application) restart(cfg map[string]interface{}) { ctx := a.startContext tag := a.tag - err := a.start(ctx, tag, cfg) + err := a.start(ctx, tag, a.restartConfig) if err != nil { a.setState(state.Crashed, fmt.Sprintf("failed to restart: %s", err), nil) } diff --git a/x-pack/elastic-agent/pkg/core/plugin/service/app.go b/x-pack/elastic-agent/pkg/core/plugin/service/app.go index 83fa39954829..8be7d53b5e14 100644 --- a/x-pack/elastic-agent/pkg/core/plugin/service/app.go +++ b/x-pack/elastic-agent/pkg/core/plugin/service/app.go @@ -166,7 +166,7 @@ func (a *Application) Start(ctx context.Context, _ app.Taggable, cfg map[string] if a.srvState != nil { a.setState(state.Starting, "Starting", nil) a.srvState.SetStatus(proto.StateObserved_STARTING, a.state.Message, a.state.Payload) - a.srvState.UpdateConfig(string(cfgStr)) + a.srvState.UpdateConfig(a.srvState.Config()) } else { a.setState(state.Starting, "Starting", nil) a.srvState, err = a.srv.Register(a, string(cfgStr))