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); doHomebrew(resp);
doUri(); doUri();


// Performance varies significantly between local testing and CI system. // To allow for timing differences between runs, a "best of n" approach
// This test regularly causes CI failures. Therefore one homebrew win is // is taken for this test
// sufficient for this test to pass. final int bestOf = 5;

final int winTarget = (bestOf + 1) / 2;
final int attempts = 5; int homebrewWin = 0;
boolean homebrewWin = false;
int count = 0; int count = 0;


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




Expand Down

0 comments on commit 44246d0

Please sign in to comment.