Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
HAWKULAR-338 End to End Tests should wait for MetricsService to
Browse files Browse the repository at this point in the history
initialize
  • Loading branch information
ppalaga committed Jun 24, 2015
1 parent b65cc9d commit 5ea6381
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,31 @@ class Scenario1ITest extends AbstractTestBase {
/* Pinger should start pinging now but we do not want to wait */

// 9 simulate ping + response - metrics for ~ the last 30 minutes

/* Wait till metrics gets initialized */
path = "/hawkular/metrics/status"
delay = 1000
attemptCount = 30
String metricsServiceStatus;
for (int i = 0; i < attemptCount; i++) {
response = client.get(path: path)
if (response.status == 200) {
metricsServiceStatus = response.data.MetricsService
if ("STARTED".equals(metricsServiceStatus)) {
/* the service has started - we can leave the loop */
break;
}
}
println "'MetricsService' not ready yet, about to retry after $delay ms"
/* sleep one second */
Thread.sleep(delay);
}
if (!"STARTED".equals(metricsServiceStatus)) {
Assert.fail("MetricsService status still '$metricsServiceStatus' after trying $attemptCount times" +
" with delay $delay ms.")
}


for (int i = -30 ; i <-3 ; i++ ) {
postMetricValue(tenantId, resourceId, statusCodeId, 100 + i, i)
postMetricValue(tenantId, resourceId, durationId, 200, i)
Expand Down

0 comments on commit 5ea6381

Please sign in to comment.