summaryrefslogtreecommitdiffstats
path: root/service-monitor/src/test
diff options
context:
space:
mode:
authorHåkon Hallingstad <hakon@verizonmedia.com>2019-02-03 23:28:36 +0100
committerHåkon Hallingstad <hakon@verizonmedia.com>2019-02-03 23:28:36 +0100
commit6256618aec4a43325c6c787ae3bee6d31c706eb4 (patch)
tree315213770eae60489fce8d379c047357e5c171dc /service-monitor/src/test
parent0e63320ed4803d38b44f380f3182abcf6d19381d (diff)
Make port tag comparison case insensitive
Diffstat (limited to 'service-monitor/src/test')
-rw-r--r--service-monitor/src/test/java/com/yahoo/vespa/service/health/StateV1HealthModelTest.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/service-monitor/src/test/java/com/yahoo/vespa/service/health/StateV1HealthModelTest.java b/service-monitor/src/test/java/com/yahoo/vespa/service/health/StateV1HealthModelTest.java
index fcbc3cd9b9f..9803fb75423 100644
--- a/service-monitor/src/test/java/com/yahoo/vespa/service/health/StateV1HealthModelTest.java
+++ b/service-monitor/src/test/java/com/yahoo/vespa/service/health/StateV1HealthModelTest.java
@@ -2,6 +2,7 @@
package com.yahoo.vespa.service.health;
import com.yahoo.config.model.api.ApplicationInfo;
+import com.yahoo.config.model.api.PortInfo;
import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.HostName;
import com.yahoo.vespa.applicationmodel.ClusterId;
@@ -23,7 +24,9 @@ import java.util.stream.Collectors;
import java.util.stream.Stream;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -88,4 +91,16 @@ public class StateV1HealthModelTest {
assertEquals(ZoneApplication.getNodeAdminClusterId(), serviceId.getClusterId());
assertEquals(ZoneApplication.getNodeAdminServiceType(), serviceId.getServiceType());
}
+
+ @Test
+ public void caseInsensitiveTagMatching() {
+ PortInfo portInfo = mock(PortInfo.class);
+ when(portInfo.getTags()).thenReturn(List.of("http", "STATE", "foo"));
+ assertTrue(StateV1HealthModel.portTaggedWith(portInfo, StateV1HealthModel.HTTP_HEALTH_PORT_TAGS));
+ assertTrue(StateV1HealthModel.portTaggedWith(portInfo, List.of("HTTP", "state")));
+
+ when(portInfo.getTags()).thenReturn(List.of("http", "foo"));
+ assertFalse(StateV1HealthModel.portTaggedWith(portInfo, StateV1HealthModel.HTTP_HEALTH_PORT_TAGS));
+ assertFalse(StateV1HealthModel.portTaggedWith(portInfo, List.of("HTTP", "state")));
+ }
} \ No newline at end of file