Search in sources :

Example 6 with Get

use of com.google.api.services.container.v1beta1.Container.Projects.Locations.Clusters.Get in project platinum by hartwigmedical.

the class KubernetesEngineTest method shouldCreateAndReturnInstanceWhenNoneExists.

@Test
public void shouldCreateAndReturnInstanceWhenNoneExists() throws IOException {
    Get foundOperation = mock(Get.class);
    Create created = mock(Create.class);
    Operation executedCreate = mock(Operation.class);
    when(clusters.get(anyString())).thenReturn(foundOperation);
    when(foundOperation.execute()).thenThrow(GoogleJsonResponseException.class);
    when(clusters.create(eq(format("projects/%s/locations/%s", PROJECT, REGION)), any())).thenReturn(created);
    when(created.execute()).thenReturn(executedCreate);
    when(executedCreate.getName()).thenReturn("created");
    mockForClusterCreation();
    victim.findOrCreate(RUN_NAME, Collections.emptyList(), JSON_KEY, BUCKET, SERVICE_ACCOUNT);
    verify(created).execute();
}
Also used : Create(com.google.api.services.container.v1beta1.Container.Projects.Locations.Clusters.Create) Get(com.google.api.services.container.v1beta1.Container.Projects.Locations.Clusters.Get) Operation(com.google.api.services.container.v1beta1.model.Operation) Test(org.junit.Test)

Aggregations

Get (com.google.api.services.container.v1beta1.Container.Projects.Locations.Clusters.Get)6 Create (com.google.api.services.container.v1beta1.Container.Projects.Locations.Clusters.Create)5 Operation (com.google.api.services.container.v1beta1.model.Operation)5 Cluster (com.google.api.services.container.v1beta1.model.Cluster)3 CreateClusterRequest (com.google.api.services.container.v1beta1.model.CreateClusterRequest)3 IOException (java.io.IOException)3 Test (org.junit.Test)3 GoogleJsonResponseException (com.google.api.client.googleapis.json.GoogleJsonResponseException)2 Container (com.google.api.services.container.v1beta1.Container)2 IPAllocationPolicy (com.google.api.services.container.v1beta1.model.IPAllocationPolicy)2 NodeConfig (com.google.api.services.container.v1beta1.model.NodeConfig)2 NodePool (com.google.api.services.container.v1beta1.model.NodePool)2 PrivateClusterConfig (com.google.api.services.container.v1beta1.model.PrivateClusterConfig)2 Console (com.hartwig.platinum.Console)2 BatchConfiguration (com.hartwig.platinum.config.BatchConfiguration)2 GcpConfiguration (com.hartwig.platinum.config.GcpConfiguration)2 PlatinumConfiguration (com.hartwig.platinum.config.PlatinumConfiguration)2 JsonKey (com.hartwig.platinum.iam.JsonKey)2 TumorNormalPair (com.hartwig.platinum.p5sample.TumorNormalPair)2 DefaultKubernetesClient (io.fabric8.kubernetes.client.DefaultKubernetesClient)2