Skip to content

Commit

Permalink
Fix flaky test TestUpgradeHandlerSameVersion (#6476)
Browse files Browse the repository at this point in the history
Increased the maximum timeout to a generous 1 second.
This does not extend the normal test execution time,
so no reason to make this timeout too restrictive.

(cherry picked from commit 8325d47)
  • Loading branch information
andrzej-stencel authored and mergify[bot] committed Jan 7, 2025
1 parent ef1462a commit dc3cd63
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,13 @@ func TestUpgradeHandler(t *testing.T) {

// Make sure this test does not dead lock or wait for too long
select {
case <-time.Tick(50 * time.Millisecond):
case <-time.Tick(1 * time.Second):
t.Fatal("mockUpgradeManager.Upgrade was not called")
case <-upgradeCalledChan:
}
}

func TestUpgradeHandlerSameVersion(t *testing.T) {
t.Skip("flaky test: https://github.com/elastic/elastic-agent/issues/5938")
// Create a cancellable context that will shut down the coordinator after
// the test.
ctx, cancel := context.WithCancel(context.Background())
Expand Down Expand Up @@ -185,7 +184,7 @@ func TestUpgradeHandlerSameVersion(t *testing.T) {

// Make sure this test does not dead lock or wait for too long
select {
case <-time.Tick(50 * time.Millisecond):
case <-time.Tick(1 * time.Second):
t.Fatal("mockUpgradeManager.Upgrade was not called")
case <-upgradeCalledChan:
}
Expand Down

0 comments on commit dc3cd63

Please sign in to comment.