use of com.yahoo.vespa.hosted.provision.Node in project vespa by vespa-engine.
the class RetireIPv4OnlyNodesTest method testSingleIPv4Address.
@Test
public void testSingleIPv4Address() {
Node node = createNodeWithAddresses("127.0.0.1");
assertTrue(policy.shouldRetire(node).isPresent());
}
use of com.yahoo.vespa.hosted.provision.Node in project vespa by vespa-engine.
the class RetireIPv4OnlyNodesTest method testNeverRetireVMs.
@Test
public void testNeverRetireVMs() {
Node node = createVMWithAddresses("127.0.0.1", "10.0.0.1", "192.168.0.1");
assertFalse(policy.shouldRetire(node).isPresent());
node = createNodeWithAddresses("::1", "::2", "1234:5678:90ab::cdef");
assertFalse(policy.shouldRetire(node).isPresent());
node = createNodeWithAddresses("127.0.0.1", "::1", "10.0.0.1", "::2");
assertFalse(policy.shouldRetire(node).isPresent());
}
use of com.yahoo.vespa.hosted.provision.Node in project vespa by vespa-engine.
the class SerializationTest method serializes_multiple_ip_addresses.
@Test
public void serializes_multiple_ip_addresses() {
byte[] nodeWithMultipleIps = createNodeJson("node4.yahoo.tld", "127.0.0.4", "::4");
Node deserializedNode = nodeSerializer.fromJson(State.provisioned, nodeWithMultipleIps);
assertEquals(ImmutableSet.of("127.0.0.4", "::4"), deserializedNode.ipAddresses());
}
use of com.yahoo.vespa.hosted.provision.Node in project vespa by vespa-engine.
the class SerializationTest method vespa_version_serialization.
@Test
public void vespa_version_serialization() throws Exception {
String nodeWithWantedVespaVersion = "{\n" + " \"type\" : \"tenant\",\n" + " \"flavor\" : \"large\",\n" + " \"openStackId\" : \"myId\",\n" + " \"hostname\" : \"myHostname\",\n" + " \"ipAddresses\" : [\"127.0.0.1\"],\n" + " \"instance\": {\n" + " \"serviceId\": \"content/myId/0/0\",\n" + " \"wantedVespaVersion\": \"6.42.2\"\n" + " }\n" + "}";
Node node = nodeSerializer.fromJson(State.active, Utf8.toBytes(nodeWithWantedVespaVersion));
assertEquals("6.42.2", node.allocation().get().membership().cluster().vespaVersion().toString());
}
use of com.yahoo.vespa.hosted.provision.Node in project vespa by vespa-engine.
the class SerializationTest method testProvisionedNodeSerialization.
@Test
public void testProvisionedNodeSerialization() {
Node node = createNode();
Node copy = nodeSerializer.fromJson(Node.State.provisioned, nodeSerializer.toJson(node));
assertEquals(node.id(), copy.id());
assertEquals(node.hostname(), copy.hostname());
assertEquals(node.state(), copy.state());
assertFalse(copy.allocation().isPresent());
assertEquals(0, copy.history().events().size());
}
Aggregations