aboutsummaryrefslogtreecommitdiffstats
path: root/container-core/src/test
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2022-10-07 10:28:45 +0200
committerGitHub <noreply@github.com>2022-10-07 10:28:45 +0200
commit7438b33d2447f5348e25c18160a592924130ee25 (patch)
treef83b786d8d424bd611ee6f50998c27da1bd3b7bc /container-core/src/test
parent973c8f0aaf9d755aebd2c9a6c2226fc81dc1b183 (diff)
parent0f15123c14bc8fec27693d4122108c9e1be67df4 (diff)
Merge pull request #24344 from vespa-engine/bratseth/return-ignored-fields
Return X-Vespa-Ignored-Fields if fields were ignored
Diffstat (limited to 'container-core/src/test')
-rw-r--r--container-core/src/test/java/com/yahoo/metrics/simple/BucketTest.java26
-rw-r--r--container-core/src/test/java/com/yahoo/metrics/simple/CounterTest.java8
-rw-r--r--container-core/src/test/java/com/yahoo/metrics/simple/MetricsTest.java5
-rw-r--r--container-core/src/test/java/com/yahoo/metrics/simple/jdisc/SnapshotConverterTest.java5
4 files changed, 18 insertions, 26 deletions
diff --git a/container-core/src/test/java/com/yahoo/metrics/simple/BucketTest.java b/container-core/src/test/java/com/yahoo/metrics/simple/BucketTest.java
index 11cc8b86a09..75d1c37c5c1 100644
--- a/container-core/src/test/java/com/yahoo/metrics/simple/BucketTest.java
+++ b/container-core/src/test/java/com/yahoo/metrics/simple/BucketTest.java
@@ -23,9 +23,10 @@ import com.yahoo.metrics.simple.UntypedMetric.AssumedType;
* Functional tests for the value buckets, as implemented in the class Bucket,
* and by extension the value store itself, UntypedValue.
*
- * @author <a href="mailto:steinar@yahoo-inc.com">Steinar Knutsen</a>
+ * @author Steinar Knutsen
*/
public class BucketTest {
+
private Bucket bucket;
@BeforeEach
@@ -55,23 +56,12 @@ public class BucketTest {
for (Entry<Identifier, UntypedMetric> x : bucket.entrySet()) {
String metricName = x.getKey().getName();
switch (metricName) {
- case "nalle":
- ++nalle;
- break;
- case "nalle_0":
- ++nalle0;
- break;
- case "nalle_1":
- ++nalle1;
- break;
- case "nalle_2":
- ++nalle2;
- break;
- case "nalle_3":
- ++nalle3;
- break;
- default:
- throw new IllegalStateException();
+ case "nalle" -> ++nalle;
+ case "nalle_0" -> ++nalle0;
+ case "nalle_1" -> ++nalle1;
+ case "nalle_2" -> ++nalle2;
+ case "nalle_3" -> ++nalle3;
+ default -> throw new IllegalStateException();
}
}
assertEquals(4, nalle);
diff --git a/container-core/src/test/java/com/yahoo/metrics/simple/CounterTest.java b/container-core/src/test/java/com/yahoo/metrics/simple/CounterTest.java
index 45a76078619..074c0c7b2e5 100644
--- a/container-core/src/test/java/com/yahoo/metrics/simple/CounterTest.java
+++ b/container-core/src/test/java/com/yahoo/metrics/simple/CounterTest.java
@@ -33,7 +33,7 @@ public class CounterTest {
}
@Test
- final void testAdd() throws InterruptedException {
+ final void testAdd() {
final String metricName = "unitTestCounter";
Counter c = receiver.declareCounter(metricName);
c.add();
@@ -47,7 +47,7 @@ public class CounterTest {
}
@Test
- final void testAddLong() throws InterruptedException {
+ final void testAddLong() {
final String metricName = "unitTestCounter";
Counter c = receiver.declareCounter(metricName);
final long twoToThePowerOfFourtyeight = 65536L * 65536L * 65536L;
@@ -62,7 +62,7 @@ public class CounterTest {
}
@Test
- final void testAddPoint() throws InterruptedException {
+ final void testAddPoint() {
final String metricName = "unitTestCounter";
Point p = receiver.pointBuilder().set("x", 2L).set("y", 3.0d).set("z", "5").build();
Counter c = receiver.declareCounter(metricName, p);
@@ -77,7 +77,7 @@ public class CounterTest {
}
@Test
- final void testAddLongPoint() throws InterruptedException {
+ final void testAddLongPoint() {
final String metricName = "unitTestCounter";
Point p = receiver.pointBuilder().set("x", 2L).set("y", 3.0d).set("z", "5").build();
Counter c = receiver.declareCounter(metricName, p);
diff --git a/container-core/src/test/java/com/yahoo/metrics/simple/MetricsTest.java b/container-core/src/test/java/com/yahoo/metrics/simple/MetricsTest.java
index f64998f0be4..dd949627f30 100644
--- a/container-core/src/test/java/com/yahoo/metrics/simple/MetricsTest.java
+++ b/container-core/src/test/java/com/yahoo/metrics/simple/MetricsTest.java
@@ -17,9 +17,10 @@ import com.yahoo.metrics.simple.jdisc.SimpleMetricConsumer;
/**
* Functional test for simple metric implementation.
*
- * @author <a href="mailto:steinar@yahoo-inc.com">Steinar Knutsen</a>
+ * @author Steinar Knutsen
*/
public class MetricsTest extends UnitTestSetup {
+
SimpleMetricConsumer metricApi;
@BeforeEach
@@ -36,7 +37,7 @@ public class MetricsTest extends UnitTestSetup {
@Test
final void smokeTest() throws InterruptedException {
final String metricName = "testMetric";
- metricApi.set(metricName, Double.valueOf(1.0d), null);
+ metricApi.set(metricName, 1.0d, null);
updater.gotData.await(10, TimeUnit.SECONDS);
Bucket s = getUpdatedSnapshot();
Collection<Entry<Point, UntypedMetric>> values = s.getValuesForMetric(metricName);
diff --git a/container-core/src/test/java/com/yahoo/metrics/simple/jdisc/SnapshotConverterTest.java b/container-core/src/test/java/com/yahoo/metrics/simple/jdisc/SnapshotConverterTest.java
index 7981e5904f3..1d5cf264964 100644
--- a/container-core/src/test/java/com/yahoo/metrics/simple/jdisc/SnapshotConverterTest.java
+++ b/container-core/src/test/java/com/yahoo/metrics/simple/jdisc/SnapshotConverterTest.java
@@ -20,6 +20,7 @@ import java.util.Map;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* @author bratseth
@@ -50,7 +51,7 @@ public class SnapshotConverterTest {
for (Map.Entry<MetricDimensions, MetricSet> entry : snapshot) {
for (Map.Entry<String, String> dv : entry.getKey()) {
- assertTrue(false);
+ fail();
}
int cnt = 0;
@@ -67,7 +68,7 @@ public class SnapshotConverterTest {
assertEquals(42.25, ((GaugeMetric) mv.getValue()).getLast(), 0.001);
assertEquals(1, ((GaugeMetric) mv.getValue()).getCount());
} else {
- assertTrue(false);
+ fail();
}
}
assertEquals(3, cnt);