diff options
author | gjoranv <gv@yahoo-inc.com> | 2017-06-01 21:21:03 +0200 |
---|---|---|
committer | gjoranv <gv@yahoo-inc.com> | 2017-06-01 21:21:03 +0200 |
commit | 5f953efac4d4a6973384ae018baa964a25c4c00f (patch) | |
tree | 3b989bd8c238219402eb757840956505f81b0de4 /config-model/src/test | |
parent | e7a298c5498f8c93e2021016ea0371d4d978fdb3 (diff) |
Add unit test.
Diffstat (limited to 'config-model/src/test')
-rw-r--r-- | config-model/src/test/java/com/yahoo/vespa/model/admin/monitoring/MetricSetTest.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/admin/monitoring/MetricSetTest.java b/config-model/src/test/java/com/yahoo/vespa/model/admin/monitoring/MetricSetTest.java index 701a7fe0d30..028be9cede3 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/admin/monitoring/MetricSetTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/admin/monitoring/MetricSetTest.java @@ -1,13 +1,16 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.admin.monitoring; +import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Sets; import org.junit.Test; import java.util.Map; +import static java.util.Collections.emptyList; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; /** * @author gjoranv @@ -15,6 +18,20 @@ import static org.junit.Assert.assertEquals; public class MetricSetTest { @Test + public void metrics_from_children_are_added() { + MetricSet child1 = new MetricSet("child1", + ImmutableList.of(new Metric("child1_metric"))); + MetricSet child2 = new MetricSet("child2", + ImmutableList.of(new Metric("child2_metric"))); + MetricSet parent = new MetricSet("parent", emptyList(), ImmutableList.of(child1, child2)); + + Map<String, Metric> parentMetrics = parent.getMetrics(); + assertEquals(2, parentMetrics.size()); + assertNotNull(parentMetrics.get("child1_metric")); + assertNotNull(parentMetrics.get("child2_metric")); + } + + @Test public void internal_metrics_take_precedence_over_metrics_from_children() { String METRIC_NAME = "metric1"; String COMMON_DIMENSION_KEY = "commonKey"; |