Skip to content

Commit

Permalink
Deflake test (#8153)
Browse files Browse the repository at this point in the history
The way backing in is implemented, we halve the backoff period per
successful request, rather than based on time. The `expect_only_good`
method makes an unpredictable number of requests, filling a time window
rather.

So this test would pass when the number of requests happened to align
with the time window (which appears to be common on travis's CPUs), and
fail if they got out of sync.

We currently have no tests for the actual backing in behaviour, but I
think that's mostly ok; we have tests that shows that we start using
servers again, and we can add more if we need to.
  • Loading branch information
illicitonion authored Aug 12, 2019
1 parent 8ec4d9c commit 721595e
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/rust/engine/serverset/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,8 @@ mod tests {

expect_only_good(&mut rt, &s, Duration::from_millis(10));

// mark_bad_as_bad asserts that we attempted to use the bad server as a side effect, so this
// checks that we did re-use the server after the lame period.
mark_bad_as_bad(&mut rt, &s, Health::Unhealthy);

expect_only_good(&mut rt, &s, Duration::from_millis(20));
Expand All @@ -402,16 +404,6 @@ mod tests {

expect_only_good(&mut rt, &s, Duration::from_millis(40));

mark_bad_as_bad(&mut rt, &s, Health::Healthy);

expect_only_good(&mut rt, &s, Duration::from_millis(20));

mark_bad_as_bad(&mut rt, &s, Health::Healthy);

expect_only_good(&mut rt, &s, Duration::from_millis(10));

mark_bad_as_bad(&mut rt, &s, Health::Healthy);

expect_both(&mut rt, &s, 2);
}

Expand Down

0 comments on commit 721595e

Please sign in to comment.