Skip to content

Commit

Permalink
Revert 1657510. Back to the "best of n" approach.
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1657607 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
markt-asf committed Feb 5, 2015
1 parent 2804880 commit 44246d0
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions test/org/apache/catalina/connector/TestResponsePerformance.java
Expand Up @@ -37,24 +37,23 @@ public void testToAbsolutePerformance() throws Exception {
doHomebrew(resp);
doUri();

// Performance varies significantly between local testing and CI system.
// This test regularly causes CI failures. Therefore one homebrew win is
// sufficient for this test to pass.

final int attempts = 5;
boolean homebrewWin = false;
// To allow for timing differences between runs, a "best of n" approach
// is taken for this test
final int bestOf = 5;
final int winTarget = (bestOf + 1) / 2;
int homebrewWin = 0;
int count = 0;

while (count < attempts && !homebrewWin) {
while (count < bestOf && homebrewWin < winTarget) {
long homebrew = doHomebrew(resp);
long uri = doUri();
log.info("Current 'home-brew': " + homebrew + "ms, Using URI: " + uri + "ms");
if (homebrew < uri) {
homebrewWin = true;
homebrewWin++;
}
count++;
}
Assert.assertTrue(homebrewWin);
Assert.assertTrue(homebrewWin == winTarget);
}


Expand Down

0 comments on commit 44246d0

Please sign in to comment.