From 5f24c59503415a520e530c41c2fb3794f595959a Mon Sep 17 00:00:00 2001 From: Brian Harrington Date: Wed, 10 Jul 2024 08:53:17 -0500 Subject: [PATCH] atlas: add test case for couldMatch with empty index --- .../spectator/atlas/impl/QueryIndexTest.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/spectator-reg-atlas/src/test/java/com/netflix/spectator/atlas/impl/QueryIndexTest.java b/spectator-reg-atlas/src/test/java/com/netflix/spectator/atlas/impl/QueryIndexTest.java index 953bf123e..c7840b14b 100644 --- a/spectator-reg-atlas/src/test/java/com/netflix/spectator/atlas/impl/QueryIndexTest.java +++ b/spectator-reg-atlas/src/test/java/com/netflix/spectator/atlas/impl/QueryIndexTest.java @@ -557,6 +557,19 @@ public void findHotSpots() { }); } + @Test + public void couldMatchEmpty() { + Registry registry = new NoopRegistry(); + QueryIndex idx = QueryIndex.newInstance(registry); + + Assertions.assertFalse(idx.couldMatch(Query.toMap(id("foo"))::get)); + Assertions.assertFalse(idx.couldMatch(Query.toMap(id("foo", "id", "bar"))::get)); + Assertions.assertFalse(idx.couldMatch(Query.toMap(id("foo", "app", "baz-main"))::get)); + Assertions.assertFalse(idx.couldMatch(Query.toMap(id("foo", "id", "baz"))::get)); + Assertions.assertFalse(idx.couldMatch(Query.toMap(id("foo2", "id", "bar"))::get)); + Assertions.assertFalse(idx.couldMatch(Query.toMap(id("foo", "app", "bar-main"))::get)); + } + @Test public void couldMatchPartial() { Registry registry = new NoopRegistry();