blob: b9d25406f9bb98a290f36fc57b268d024fae8760 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.service.monitor.internal.health;
import com.yahoo.cloud.config.ConfigserverConfig;
import com.yahoo.config.model.api.ApplicationInfo;
import com.yahoo.vespa.applicationmodel.ClusterId;
import com.yahoo.vespa.applicationmodel.ConfigId;
import com.yahoo.vespa.applicationmodel.ServiceStatus;
import com.yahoo.vespa.applicationmodel.ServiceType;
import com.yahoo.vespa.service.monitor.application.ZoneApplication;
import com.yahoo.vespa.service.monitor.internal.ConfigserverUtil;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class HealthMonitorManagerTest {
@Test
public void addRemove() {
ConfigserverConfig config = ConfigserverUtil.createExampleConfigserverConfig();
HealthMonitorManager manager = new HealthMonitorManager(config);
ApplicationInfo applicationInfo = ConfigserverUtil.makeExampleConfigServer();
manager.applicationActivated(applicationInfo);
manager.applicationRemoved(applicationInfo.getApplicationId());
}
@Test
public void withNodeAdmin() {
ConfigserverConfig config = ConfigserverUtil.createExampleConfigserverConfig();
HealthMonitorManager manager = new HealthMonitorManager(config);
ServiceStatus status = manager.getStatus(
ZoneApplication.ZONE_APPLICATION_ID,
ClusterId.NODE_ADMIN,
ServiceType.CONTAINER,
new ConfigId("config-id-1"));
assertEquals(ServiceStatus.NOT_CHECKED, status);
}
@Test
public void withHostAdmin() {
ConfigserverConfig config = ConfigserverUtil.createExampleConfigserverConfig(false, true);
HealthMonitorManager manager = new HealthMonitorManager(config);
ServiceStatus status = manager.getStatus(
ZoneApplication.ZONE_APPLICATION_ID,
ClusterId.NODE_ADMIN,
ServiceType.CONTAINER,
new ConfigId("config-id-1"));
assertEquals(ServiceStatus.UP, status);
}
}
|