Skip to content

Commit

Permalink
MONDRIAN: updated timed test to use a computational baseline, so whil…
Browse files Browse the repository at this point in the history
…e running in slow environments, such as cobertura, the test still may pass. This is necessary to get all tests to run on http://ci.pentaho.com/job/mondrian

[git-p4: depot-paths = "//open/mondrian/": change = 12249]
  • Loading branch information
Will Gorman committed Jan 20, 2009
1 parent 5fb985e commit b1af6e7
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion testsrc/main/mondrian/rolap/HighDimensionsTest.java
Expand Up @@ -35,6 +35,25 @@ public HighDimensionsTest(String name) {
}

public void testBug1971406() throws Exception {
// build up a baseline time value
// this is necessary for environments that might
// run code coverage / etc
// This baseline takes about 1 second on a Dell Latitude D820 Laptop.

final long nt0 = System.currentTimeMillis();
int t = 0;
for (int i = 0; i < Integer.MAX_VALUE; i++) {
t += i;
}
final long nt1 = System.currentTimeMillis();
long baselineTime = 0;

// this check is here to make sure the compiler doesn't optimize
// out the above loop
if (t > 0) {
baselineTime = nt1 - nt0;
}

final Connection connection = TestContext.instance()
.getFoodMartConnection();
Query query = connection.parseQuery(
Expand All @@ -50,7 +69,7 @@ public void testBug1971406() throws Exception {
assertNotNull(o.get(0));
}
final long t1 = System.currentTimeMillis();
assertTrue(t1 - t0 < 60000);
assertTrue("Query failed to execute within " + (60 * baselineTime) + " milliseconds", t1 - t0 < 60 * baselineTime);
}


Expand Down

0 comments on commit b1af6e7

Please sign in to comment.