use of bio.terra.workspace.generated.model.ApiAzureDiskCreationParameters in project terra-workspace-manager by DataBiosphere.
the class CreateAndDeleteAzureControlledResourceFlightTest method createDisk.
private ControlledAzureDiskResource createDisk(UUID workspaceId, AuthenticatedUserRequest userRequest) throws InterruptedException {
final ApiAzureDiskCreationParameters creationParameters = ControlledResourceFixtures.getAzureDiskCreationParameters();
// TODO: make this application-private resource once the POC supports it
final UUID resourceId = UUID.randomUUID();
ControlledAzureDiskResource resource = ControlledAzureDiskResource.builder().common(ControlledResourceFields.builder().workspaceId(workspaceId).resourceId(resourceId).name(getAzureName("disk")).description(getAzureName("disk-desc")).cloningInstructions(CloningInstructions.COPY_RESOURCE).accessScope(AccessScopeType.fromApi(ApiAccessScope.SHARED_ACCESS)).managedBy(ManagedByType.fromApi(ApiManagedBy.USER)).build()).diskName(creationParameters.getName()).region(creationParameters.getRegion()).size(creationParameters.getSize()).build();
// Submit a Disk creation flight.
FlightState flightState = StairwayTestUtils.blockUntilFlightCompletes(jobService.getStairway(), CreateControlledResourceFlight.class, azureTestUtils.createControlledResourceInputParameters(workspaceId, userRequest, resource), STAIRWAY_FLIGHT_TIMEOUT, null);
assertEquals(FlightStatus.SUCCESS, flightState.getFlightStatus());
return resource;
}
use of bio.terra.workspace.generated.model.ApiAzureDiskCreationParameters in project terra-workspace-manager by DataBiosphere.
the class GetAzureDiskStepTest method getDisk_alreadyExists.
@Test
public void getDisk_alreadyExists() throws InterruptedException {
final ApiAzureDiskCreationParameters creationParameters = ControlledResourceFixtures.getAzureDiskCreationParameters();
GetAzureDiskStep step = new GetAzureDiskStep(mockAzureConfig, mockCrlService, ControlledResourceFixtures.getAzureDisk(creationParameters.getName(), creationParameters.getRegion(), creationParameters.getSize()));
when(mockDisks.getByResourceGroup(mockAzureCloudContext.getAzureResourceGroupId(), creationParameters.getName())).thenReturn(mockDisk);
final StepResult stepResult = step.doStep(mockFlightContext);
// Verify step returns error
assertThat(stepResult.getStepStatus(), equalTo(StepStatus.STEP_RESULT_FAILURE_FATAL));
assertThat(stepResult.getException().get(), instanceOf(DuplicateResourceException.class));
}
use of bio.terra.workspace.generated.model.ApiAzureDiskCreationParameters in project terra-workspace-manager by DataBiosphere.
the class GetAzureDiskStepTest method getDisk_doesNotExist.
@Test
public void getDisk_doesNotExist() throws InterruptedException {
final ApiAzureDiskCreationParameters creationParameters = ControlledResourceFixtures.getAzureDiskCreationParameters();
GetAzureDiskStep step = new GetAzureDiskStep(mockAzureConfig, mockCrlService, ControlledResourceFixtures.getAzureDisk(creationParameters.getName(), creationParameters.getRegion(), creationParameters.getSize()));
when(mockDisks.getByResourceGroup(mockAzureCloudContext.getAzureResourceGroupId(), creationParameters.getName())).thenThrow(mockException);
final StepResult stepResult = step.doStep(mockFlightContext);
// Verify step returns success
assertThat(stepResult, equalTo(StepResult.getStepResultSuccess()));
}
Aggregations