Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry-pick #23579 to 7.x: Fix flaky TestConfigurable* unit tests #23591

Merged
merged 1 commit into from
Jan 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions x-pack/elastic-agent/pkg/agent/operation/operator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,16 @@ func TestConfigurableRun(t *testing.T) {
return nil
})

// wait to finish configuring
waitFor(t, func() error {
items := operator.State()
item, ok := items[p.ID()]
if ok && item.Status == state.Configuring {
return fmt.Errorf("process still configuring")
}
return nil
})

items := operator.State()
item0, ok := items[p.ID()]
if !ok || item0.Status != state.Running {
Expand Down Expand Up @@ -379,8 +389,6 @@ func TestConfigurableStartStop(t *testing.T) {
}

func TestConfigurableService(t *testing.T) {
t.Skipf("flaky see https://github.com/elastic/beats/issues/20836")

p := getProgram("serviceable", "1.0")

operator := getTestOperator(t, downloadPath, installPath, p)
Expand Down Expand Up @@ -427,6 +435,16 @@ func TestConfigurableService(t *testing.T) {
return nil
})

// wait to finish configuring
waitFor(t, func() error {
items := operator.State()
item, ok := items[p.ID()]
if ok && item.Status == state.Configuring {
return fmt.Errorf("process still configuring")
}
return nil
})

items := operator.State()
item0, ok := items[p.ID()]
if !ok || item0.Status != state.Running {
Expand Down