Skip to content

Commit

Permalink
Increasing margins with times to avoid flakiness
Browse files Browse the repository at this point in the history
  • Loading branch information
ycombinator committed Sep 7, 2023
1 parent be1206b commit cbfe0e3
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions internal/pkg/agent/install/progress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ func TestProgress(t *testing.T) {
t.Run("single_step_delayed_failure", func(t *testing.T) {
w := newTestWriter()
pt := NewProgressTracker(w)
pt.SetTickInterval(10 * time.Millisecond) // to speed up testing
pt.SetTickInterval(20 * time.Millisecond) // to speed up testing
pt.DisableRandomizedTickIntervals()

pt.Start()

pt.StepStart("step 1 starting")
time.Sleep(25 * time.Millisecond) // to simulate work being done
time.Sleep(45 * time.Millisecond) // to simulate work being done
pt.StepFailed()

pt.Stop()
Expand Down Expand Up @@ -78,34 +78,34 @@ func TestProgress(t *testing.T) {
t.Run("multi_step_delayed_success", func(t *testing.T) {
w := newTestWriter()
pt := NewProgressTracker(w)
pt.SetTickInterval(10 * time.Millisecond) // to speed up testing
pt.SetTickInterval(20 * time.Millisecond) // to speed up testing
pt.DisableRandomizedTickIntervals()

pt.Start()

pt.StepStart("step 1 starting")
time.Sleep(55 * time.Millisecond) // to simulate work being done
time.Sleep(110 * time.Millisecond) // to simulate work being done
pt.StepSucceeded()
pt.StepStart("step 2 starting")
time.Sleep(15 * time.Millisecond) // to simulate work being done
time.Sleep(50 * time.Millisecond) // to simulate work being done
pt.StepSucceeded()

pt.Stop()

require.Equal(t, "step 1 starting........ DONE\nstep 2 starting.... DONE\n", string(w.buf))
require.Equal(t, "step 1 starting........ DONE\nstep 2 starting..... DONE\n", string(w.buf))
})

t.Run("single_step_delay_after_success", func(t *testing.T) {
w := newTestWriter()
pt := NewProgressTracker(w)
pt.SetTickInterval(10 * time.Millisecond) // to speed up testing
pt.SetTickInterval(20 * time.Millisecond) // to speed up testing
pt.DisableRandomizedTickIntervals()

pt.Start()

pt.StepStart("step 1 starting")
pt.StepFailed()
time.Sleep(25 * time.Millisecond) // to simulate work being done
time.Sleep(50 * time.Millisecond) // to simulate work being done

pt.Stop()

Expand Down

0 comments on commit cbfe0e3

Please sign in to comment.