diff options
author | Håkon Hallingstad <hakon@yahooinc.com> | 2021-09-13 16:49:48 +0200 |
---|---|---|
committer | Håkon Hallingstad <hakon@yahooinc.com> | 2021-09-13 16:49:48 +0200 |
commit | 7088870382b4f78ef3c0375e845b587e7211cd95 (patch) | |
tree | 828a62358d6fcc1b88d3ccf826fd020cbfeda943 /service-monitor/src | |
parent | a3fcef7201b804437becb7773821bb1457a1c8ce (diff) |
Use unknown service status in tests
Diffstat (limited to 'service-monitor/src')
3 files changed, 9 insertions, 9 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 70454ffdd58..20f7fb8e086 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 @@ -33,15 +33,15 @@ import static org.mockito.Mockito.when; * @author hakonhall */ public class StateV1HealthModelTest { - private RunletExecutor executor = mock(RunletExecutor.class); - private Duration healthStaleness = Duration.ofSeconds(1); - private Duration requestTimeout = Duration.ofSeconds(2); - private Duration keepAlive = Duration.ofSeconds(3); + private final RunletExecutor executor = mock(RunletExecutor.class); + private final Duration healthStaleness = Duration.ofSeconds(1); + private final Duration requestTimeout = Duration.ofSeconds(2); + private final Duration keepAlive = Duration.ofSeconds(3); private final ProxyHostApplication proxyHostApplication = new ProxyHostApplication(); private final List<HostName> hostnames = Stream.of("host1", "host2").map(HostName::from).collect(Collectors.toList()); private final ApplicationInfo proxyHostApplicationInfo = proxyHostApplication.makeApplicationInfo(hostnames); - private final StateV1HealthModel model = new StateV1HealthModel(healthStaleness, requestTimeout, keepAlive, executor, false); + private final StateV1HealthModel model = new StateV1HealthModel(healthStaleness, requestTimeout, keepAlive, executor, true); @Test public void test() { @@ -64,7 +64,7 @@ public class StateV1HealthModelTest { Cancellable cancellable = mock(Cancellable.class); when(executor.scheduleWithFixedDelay(any(), any())).thenReturn(cancellable); try (HealthMonitor healthMonitor = endpoint1.startMonitoring()) { - assertEquals(ServiceStatus.NOT_CHECKED, healthMonitor.getStatus().serviceStatus()); + assertEquals(ServiceStatus.UNKNOWN, healthMonitor.getStatus().serviceStatus()); } } diff --git a/service-monitor/src/test/java/com/yahoo/vespa/service/health/StateV1HealthMonitorTest.java b/service-monitor/src/test/java/com/yahoo/vespa/service/health/StateV1HealthMonitorTest.java index bec33a7dbfd..98b89422e42 100644 --- a/service-monitor/src/test/java/com/yahoo/vespa/service/health/StateV1HealthMonitorTest.java +++ b/service-monitor/src/test/java/com/yahoo/vespa/service/health/StateV1HealthMonitorTest.java @@ -17,10 +17,10 @@ public class StateV1HealthMonitorTest { public void downThenUpThenDown() throws Exception { StateV1HealthClient client = mock(StateV1HealthClient.class); - StateV1HealthUpdater updater = new StateV1HealthUpdater("https://foo/state/v1/health", client, false); + StateV1HealthUpdater updater = new StateV1HealthUpdater("https://foo/state/v1/health", client, true); RunletExecutor executor = new RunletExecutorImpl(2); try (StateV1HealthMonitor monitor = new StateV1HealthMonitor(updater, executor, Duration.ofMillis(10))) { - assertEquals(ServiceStatus.NOT_CHECKED, monitor.getStatus().serviceStatus()); + assertEquals(ServiceStatus.UNKNOWN, monitor.getStatus().serviceStatus()); when(client.get()).thenReturn(HealthInfo.fromHealthStatusCode(HealthInfo.UP_STATUS_CODE)); while (monitor.getStatus().serviceStatus() != ServiceStatus.UP) { diff --git a/service-monitor/src/test/java/com/yahoo/vespa/service/health/StateV1HealthUpdaterTest.java b/service-monitor/src/test/java/com/yahoo/vespa/service/health/StateV1HealthUpdaterTest.java index 833507dfb6e..0a6583dab17 100644 --- a/service-monitor/src/test/java/com/yahoo/vespa/service/health/StateV1HealthUpdaterTest.java +++ b/service-monitor/src/test/java/com/yahoo/vespa/service/health/StateV1HealthUpdaterTest.java @@ -165,6 +165,6 @@ public class StateV1HealthUpdaterTest { private StateV1HealthUpdater makeUpdater(CloseableHttpClient client, Function<HttpEntity, String> getContentFunction) { ApacheHttpClient apacheHttpClient = new ApacheHttpClient(url, client); StateV1HealthClient healthClient = new StateV1HealthClient(apacheHttpClient, getContentFunction); - return new StateV1HealthUpdater(url.toString(), healthClient, false); + return new StateV1HealthUpdater(url.toString(), healthClient, true); } }
\ No newline at end of file |