diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2021-12-17 22:20:24 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2021-12-17 22:20:24 +0100 |
commit | 5dde463829fddd3d01789dcda8da4f146653e269 (patch) | |
tree | f6fe57cd38dbfb9b2a9f15cde44528c466b410aa /metrics-proxy | |
parent | cc857482b85c46d08de6eebce243ebe3a43de544 (diff) |
Add test for dimensions incorrectly containing null
Diffstat (limited to 'metrics-proxy')
-rw-r--r-- | metrics-proxy/src/test/java/ai/vespa/metricsproxy/service/MetricsFetcherTest.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/metrics-proxy/src/test/java/ai/vespa/metricsproxy/service/MetricsFetcherTest.java b/metrics-proxy/src/test/java/ai/vespa/metricsproxy/service/MetricsFetcherTest.java index 56e78e3930c..b30e871a543 100644 --- a/metrics-proxy/src/test/java/ai/vespa/metricsproxy/service/MetricsFetcherTest.java +++ b/metrics-proxy/src/test/java/ai/vespa/metricsproxy/service/MetricsFetcherTest.java @@ -11,6 +11,7 @@ import java.io.IOException; import static ai.vespa.metricsproxy.metric.model.MetricId.toMetricId; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; /** @@ -51,6 +52,30 @@ public class MetricsFetcherTest { } @Test + public void testSkippingNullDimensions() throws IOException { + String jsonData = + "{\"status\" : {\"code\" : \"up\",\"message\" : \"Everything ok here\"}," + + "\"metrics\" : {\"snapshot\" : {\"from\" : 1334134640.089,\"to\" : 1334134700.088" + " }," + + "\"values\" : [" + + "{" + + " \"name\" : \"some.bogus.metric\"," + + " \"values\" : {" + + " \"count\" : 12," + + " \"rate\" : 0.2" + + " }," + + " \"dimensions\" : {" + + " \"version\" : null" + + " }" + + " }" + + "]}}"; + + Metrics metrics = fetch(jsonData); + assertEquals(2, metrics.size()); + assertTrue(metrics.list().get(0).getDimensions().isEmpty()); + assertTrue(metrics.list().get(1).getDimensions().isEmpty()); + } + + @Test public void testErrors() throws IOException { String jsonData; Metrics metrics = null; |