Search in sources :

Example 1 with NodePool

use of com.google.container.v1.NodePool in project java-container by googleapis.

the class ITSystemTest method listNodePoolsTest.

@Test
public void listNodePoolsTest() {
    ListNodePoolsResponse response = client.listNodePools(PROJECT_ID, ZONE, CLUSTER_NAME);
    List<NodePool> nodePools = response.getNodePoolsList();
    for (NodePool nodePool : nodePools) {
        if (NODE_POOL_NAME.equals(nodePool.getName())) {
            assertEquals(NODE_POOL_NAME, nodePool.getName());
            assertEquals(INITIAL_NODE_COUNT, nodePool.getInitialNodeCount());
            assertEquals(NODE_POOL_SEL_LINK, nodePool.getSelfLink());
        }
    }
}
Also used : NodePool(com.google.container.v1.NodePool) ListNodePoolsResponse(com.google.container.v1.ListNodePoolsResponse) Test(org.junit.Test)

Example 2 with NodePool

use of com.google.container.v1.NodePool in project java-container by googleapis.

the class ITSystemTest method getClusterTest.

@Test
public void getClusterTest() {
    Cluster cluster = client.getCluster(PROJECT_ID, ZONE, CLUSTER_NAME);
    NodePool nodePool = client.getNodePool(PROJECT_ID, ZONE, CLUSTER_NAME, NODE_POOL_NAME);
    assertEquals(CLUSTER_NAME, cluster.getName());
    assertEquals(DETAIL, cluster.getDescription());
    assertEquals(ZONE, cluster.getLocation());
    assertEquals(SELF_LINK, cluster.getSelfLink());
    assertEquals(NETWORK, cluster.getNetwork());
    assertEquals(INITIAL_NODE_COUNT, nodePool.getInitialNodeCount());
}
Also used : NodePool(com.google.container.v1.NodePool) Cluster(com.google.container.v1.Cluster) Test(org.junit.Test)

Example 3 with NodePool

use of com.google.container.v1.NodePool in project java-container by googleapis.

the class ITSystemTest method beforeClass.

@BeforeClass
public static void beforeClass() throws Exception {
    client = ClusterManagerClient.create();
    Util.cleanUpExistingInstanceCluster(PROJECT_ID, ZONE, client);
    /**
     * create node pool*
     */
    NodePool nodePool = NodePool.newBuilder().setInitialNodeCount(INITIAL_NODE_COUNT).setName(NODE_POOL_NAME).setSelfLink(NODE_POOL_SEL_LINK).setStatusMessage(STATUS_MESSAGE).build();
    /**
     * create cluster
     */
    Cluster cluster = Cluster.newBuilder().setName(CLUSTER_NAME).setLocation("us-central1").setDescription(DETAIL).setSelfLink(SELF_LINK).addNodePools(nodePool).setStatusMessage(STATUS_MESSAGE).setNetwork(NETWORK).build();
    operation = client.createCluster(PROJECT_ID, ZONE, cluster);
    LOG.info(String.format("%s cluster created successfully.", CLUSTER_NAME));
    LOG.info(String.format("%s node pool created successfully.", NODE_POOL_NAME));
}
Also used : NodePool(com.google.container.v1.NodePool) Cluster(com.google.container.v1.Cluster) BeforeClass(org.junit.BeforeClass)

Example 4 with NodePool

use of com.google.container.v1.NodePool in project java-container by googleapis.

the class ITSystemTest method listClusterTest.

@Test
public void listClusterTest() {
    ListClustersResponse clustersResponse = client.listClusters(PROJECT_ID, ZONE);
    List<Cluster> clusters = clustersResponse.getClustersList();
    NodePool nodePool = client.getNodePool(PROJECT_ID, ZONE, CLUSTER_NAME, NODE_POOL_NAME);
    for (Cluster cluster : clusters) {
        if (CLUSTER_NAME.equals(cluster.getName())) {
            assertEquals(CLUSTER_NAME, cluster.getName());
            assertEquals(DETAIL, cluster.getDescription());
            assertEquals(ZONE, cluster.getLocation());
            assertEquals(SELF_LINK, cluster.getSelfLink());
            assertEquals(NETWORK, cluster.getNetwork());
            assertEquals(INITIAL_NODE_COUNT, nodePool.getInitialNodeCount());
        }
    }
}
Also used : NodePool(com.google.container.v1.NodePool) Cluster(com.google.container.v1.Cluster) ListClustersResponse(com.google.container.v1.ListClustersResponse) Test(org.junit.Test)

Example 5 with NodePool

use of com.google.container.v1.NodePool in project java-container by googleapis.

the class ITSystemTest method getNodePoolTest.

@Test
public void getNodePoolTest() {
    NodePool nodePool = client.getNodePool(PROJECT_ID, ZONE, CLUSTER_NAME, NODE_POOL_NAME);
    assertEquals(NODE_POOL_NAME, nodePool.getName());
    assertEquals(INITIAL_NODE_COUNT, nodePool.getInitialNodeCount());
    assertEquals(NODE_POOL_SEL_LINK, nodePool.getSelfLink());
}
Also used : NodePool(com.google.container.v1.NodePool) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)17 NodePool (com.google.container.v1.NodePool)11 AbstractMessage (com.google.protobuf.AbstractMessage)10 ArrayList (java.util.ArrayList)10 Cluster (com.google.container.v1.Cluster)5 StatusCondition (com.google.container.v1.StatusCondition)4 InvalidArgumentException (com.google.api.gax.rpc.InvalidArgumentException)3 ListNodePoolsResponse (com.google.container.v1.ListNodePoolsResponse)3 NodePool (com.google.container.v1beta1.NodePool)3 StatusRuntimeException (io.grpc.StatusRuntimeException)3 CreateNodePoolRequest (com.google.container.v1.CreateNodePoolRequest)2 GetClusterRequest (com.google.container.v1.GetClusterRequest)2 GetNodePoolRequest (com.google.container.v1.GetNodePoolRequest)2 ListNodePoolsRequest (com.google.container.v1.ListNodePoolsRequest)2 Operation (com.google.container.v1.Operation)2 StatusCondition (com.google.container.v1beta1.StatusCondition)2 ListClustersResponse (com.google.container.v1.ListClustersResponse)1 CreateNodePoolRequest (com.google.container.v1beta1.CreateNodePoolRequest)1 GetNodePoolRequest (com.google.container.v1beta1.GetNodePoolRequest)1 Operation (com.google.container.v1beta1.Operation)1