blob: 12852c9d54c2de7340895c0fe74456dd64ab670c (
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
|
// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.container.jdisc.state;
import com.fasterxml.jackson.databind.JsonNode;
import org.junit.Test;
import java.nio.file.Path;
import static org.junit.Assert.assertEquals;
/**
* @author olaa
*/
public class HostLifeGathererTest {
@Test
public void host_is_alive() {
JsonNode packet = HostLifeGatherer.getHostLifePacket(new MockFileWrapper());
JsonNode metrics = packet.get("metrics");
assertEquals("host_life", packet.get("application").textValue());
assertEquals(0, packet.get("status_code").intValue());
assertEquals("OK", packet.get("status_msg").textValue());
assertEquals(123L, metrics.get("uptime").longValue());
assertEquals(1, metrics.get("alive").intValue());
}
static class MockFileWrapper extends FileWrapper {
@Override
long getFileAgeInSeconds(Path path) {
return 123;
}
}
}
|