Skip to content

Commit

Permalink
[HWKMETRICS-129] verify that we persist retention settings
Browse files Browse the repository at this point in the history
  • Loading branch information
John Sanda committed Jun 11, 2015
1 parent f8e940b commit 3f6ea1a
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,25 @@ public void createCounterWithTags() throws Exception {
assertMetricsTagsIndexMatches(tenantId, "x", singletonList(new MetricsTagsIndexEntry("1", COUNTER, id)));
}

@Test
public void createCounterWithDataRetention() throws Exception {
String tenantId = "counter-tenant";
String group = "counter-retention";
String name = "retention-counter";
MetricId id = new MetricId(group, name);
Integer retention = 100;

Metric<?> counter = new Metric<>(tenantId, COUNTER, id, emptyMap(), retention);
metricsService.createMetric(counter).toBlocking().lastOrDefault(null);

Metric<?> actual = metricsService.findMetric(tenantId, COUNTER, id).toBlocking().lastOrDefault(null);
assertEquals(actual, counter, "The counter metric does not match");

assertMetricIndexMatches(tenantId, COUNTER, singletonList(counter));
assertDataRetentionsIndexMatches(tenantId, COUNTER_RATE, ImmutableSet.of(
new Retention(metricsService.denormalizeId(COUNTER, id), retention)));
}

@Test
public void updateMetricTags() throws Exception {
Metric<Double> metric = new Metric<>("t1", GAUGE, new MetricId("m1"),
Expand Down

0 comments on commit 3f6ea1a

Please sign in to comment.