Search in sources :

Example 1 with Node

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());
}
Also used : Node(com.yahoo.vespa.hosted.provision.Node) Test(org.junit.Test)

Example 2 with Node

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());
}
Also used : Node(com.yahoo.vespa.hosted.provision.Node) Test(org.junit.Test)

Example 3 with Node

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());
}
Also used : Node(com.yahoo.vespa.hosted.provision.Node) Test(org.junit.Test)

Example 4 with Node

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());
}
Also used : Node(com.yahoo.vespa.hosted.provision.Node) Test(org.junit.Test)

Example 5 with Node

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());
}
Also used : Node(com.yahoo.vespa.hosted.provision.Node) Test(org.junit.Test)

Aggregations

Node (com.yahoo.vespa.hosted.provision.Node)121 Test (org.junit.Test)67 ApplicationId (com.yahoo.config.provision.ApplicationId)40 ClusterSpec (com.yahoo.config.provision.ClusterSpec)33 List (java.util.List)26 ArrayList (java.util.ArrayList)23 Zone (com.yahoo.config.provision.Zone)22 Flavor (com.yahoo.config.provision.Flavor)21 HashSet (java.util.HashSet)19 Collectors (java.util.stream.Collectors)19 Optional (java.util.Optional)18 NodeRepository (com.yahoo.vespa.hosted.provision.NodeRepository)16 Duration (java.time.Duration)16 HostSpec (com.yahoo.config.provision.HostSpec)15 NodeType (com.yahoo.config.provision.NodeType)15 Agent (com.yahoo.vespa.hosted.provision.node.Agent)13 Map (java.util.Map)13 HashMap (java.util.HashMap)12 Collections (java.util.Collections)11 Set (java.util.Set)11