use of com.google.cloud.notebooks.v1beta1.Instance in project java-notebooks by googleapis.
the class ITNotebookServiceClientTest method testSetInstanceMachineType.
@Test
public void testSetInstanceMachineType() throws ExecutionException, InterruptedException {
this.stopInstance();
SetInstanceMachineTypeRequest request = SetInstanceMachineTypeRequest.newBuilder().setName(INSTANCE_NAME).setMachineType(MACHINE_TYPE_B).build();
Instance response = client.setInstanceMachineTypeAsync(request).get();
assertTrue(response.getMachineType().endsWith(MACHINE_TYPE_B));
this.startInstance();
}
use of com.google.cloud.notebooks.v1beta1.Instance in project java-notebooks by googleapis.
the class ITNotebookServiceClientTest method testSetInstanceAccelarator.
@Test
public void testSetInstanceAccelarator() throws ExecutionException, InterruptedException {
this.stopInstance();
SetInstanceAcceleratorRequest request = SetInstanceAcceleratorRequest.newBuilder().setName(INSTANCE_NAME).setType(Instance.AcceleratorType.NVIDIA_TESLA_P4).setCoreCount(1L).build();
Instance response = client.setInstanceAcceleratorAsync(request).get();
this.startInstance();
assertEquals(response.getAcceleratorConfig().getType().name(), Instance.AcceleratorType.NVIDIA_TESLA_P4.name());
}
use of com.google.cloud.notebooks.v1beta1.Instance in project java-notebooks by googleapis.
the class ITNotebookServiceClientTest method testResetInstance.
@Test
public void testResetInstance() throws ExecutionException, InterruptedException {
ResetInstanceRequest request = ResetInstanceRequest.newBuilder().setName(INSTANCE_NAME).build();
Instance response = client.resetInstanceAsync(request).get();
assertTrue(response.getMachineType().endsWith(MACHINE_TYPE_B));
}
use of com.google.cloud.notebooks.v1beta1.Instance in project java-notebooks by googleapis.
the class ITNotebookServiceClientTest method testSetInstanceLabels.
@Test
public void testSetInstanceLabels() throws ExecutionException, InterruptedException {
SetInstanceLabelsRequest setInstanceLabelsRequest = SetInstanceLabelsRequest.newBuilder().setName(INSTANCE_NAME).putLabels("a", "100").build();
Instance response = client.setInstanceLabelsAsync(setInstanceLabelsRequest).get();
assertEquals(response.getLabelsMap().get("a"), "100");
}
use of com.google.cloud.notebooks.v1beta1.Instance in project java-notebooks by googleapis.
the class ITNotebookServiceClientTest method startInstance.
private String startInstance() throws ExecutionException, InterruptedException {
StartInstanceRequest request = StartInstanceRequest.newBuilder().setName(INSTANCE_NAME).build();
Instance response = client.startInstanceAsync(request).get();
return response.getState().name();
}
Aggregations