Skip to content

Commit

Permalink
Fix MixedMetricsITest
Browse files Browse the repository at this point in the history
  • Loading branch information
burmanm committed Jul 4, 2017
1 parent a18f762 commit 7872150
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -452,13 +452,13 @@ public Observable<ResultSet> createTempTablesIfNotExists(final Set<Long> timesta
})

.flatMapIterable(s -> s)
.flatMap(this::createTemporaryTable);
.zipWith(Observable.interval(500, TimeUnit.MILLISECONDS), (st, l) -> st)
.concatMap(this::createTemporaryTable);
}

Observable<ResultSet> createTemporaryTable(String tempTableName) {
return Observable.just(tempTableName)
.map(t -> new SimpleStatement(String.format(TempStatement.CREATE_TABLE.getStatement(), t)))
.zipWith(Observable.interval(1, TimeUnit.SECONDS), (st, l) -> st)
.flatMap(st -> rxSession.execute(st));
}

Expand Down Expand Up @@ -1479,6 +1479,10 @@ public Observable<Row> findStringData(MetricId<String> id, long startTime, long

@Override
public <T> Observable<ResultSet> deleteMetricData(MetricId<T> id) {
if(id.getType() == STRING) {
return rxSession.execute(deleteMetricData.bind(id.getTenantId(), id.getType().getCode(), id.getName(), DPART));
}

return getPrepForAllTempTables(TempStatement.DELETE_DATA)
.flatMap(p -> rxSession.execute(p.bind(id.getTenantId(), id.getType().getCode(), id.getName()
, DPART)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ public Completable verifyAndCreateTempTables(ZonedDateTime startTime, ZonedDateT
startTime = startTime.plus(2, ChronoUnit.HOURS);
}

return dataAccess.createTempTablesIfNotExists(timestamps);
return Completable.fromObservable(dataAccess.createTempTablesIfNotExists(timestamps));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ private <T, V> void createAndDeleteMetrics(MetricType<T> mType, T[] dataPointVal
assertEquals(actualMetric.getMetricId(), checkId);
}

actualDataPoints = metricsService.findDataPoints(checkId, 0, 100, 100, Order.ASC).toList()
actualDataPoints = metricsService.findDataPoints(checkId, now, now+100, 100, Order.ASC).toList()
.toBlocking().firstOrDefault(null);
if (deletedMetrics.contains(checkMetric)) {
assertEquals(actualDataPoints.isEmpty(), true);
Expand Down

0 comments on commit 7872150

Please sign in to comment.