use of bio.terra.buffer.service.resource.FlightManager in project terra-resource-buffer by DataBiosphere.
the class CreateProjectFlightIntegrationTest method testCreateGoogleProject_createLogBucket_false.
@Test
public void testCreateGoogleProject_createLogBucket_false() throws Exception {
FlightManager manager = new FlightManager(bufferDao, flightSubmissionFactoryImpl, stairwayComponent, transactionTemplate);
Pool pool = preparePool(bufferDao, newBasicGcpConfig().storage(new Storage().createLogBucket(false)));
String flightId = manager.submitCreationFlight(pool).get();
ResourceId resourceId = extractResourceIdFromFlightState(blockUntilFlightComplete(stairwayComponent, flightId));
Project project = assertProjectExists(resourceId);
String projectId = project.getProjectId();
String logBucketName = "storage-logs-" + projectId;
assertNull(storageCow.get(logBucketName));
}
use of bio.terra.buffer.service.resource.FlightManager in project terra-resource-buffer by DataBiosphere.
the class CreateProjectFlightIntegrationTest method testCreateGoogleProject_blockedRegions.
@Test
public void testCreateGoogleProject_blockedRegions() throws Exception {
List<String> blockedRegions = ImmutableList.of("europe-west2", "us-west4");
FlightManager manager = new FlightManager(bufferDao, flightSubmissionFactoryImpl, stairwayComponent, transactionTemplate);
Pool pool = preparePool(bufferDao, newBasicGcpConfig().network(new bio.terra.buffer.generated.model.Network().blockedRegions(blockedRegions)));
String flightId = manager.submitCreationFlight(pool).get();
ResourceId resourceId = extractResourceIdFromFlightState(blockUntilFlightComplete(stairwayComponent, flightId));
Project project = assertProjectExists(resourceId);
assertNoSubnetsInBlockedRegions(project, blockedRegions);
}
use of bio.terra.buffer.service.resource.FlightManager in project terra-resource-buffer by DataBiosphere.
the class CreateProjectFlightIntegrationTest method testCreateGoogleProject_multipleSteps.
@Test
public void testCreateGoogleProject_multipleSteps() throws Exception {
// Verify flight is able to finish with multiple same steps exists.
FlightManager manager = new FlightManager(bufferDao, new StubSubmissionFlightFactory(MultiInstanceStepFlight.class), stairwayComponent, transactionTemplate);
Pool pool = preparePool(bufferDao, newFullGcpConfig());
String flightId = manager.submitCreationFlight(pool).get();
ResourceId resourceId = extractResourceIdFromFlightState(blockUntilFlightComplete(stairwayComponent, flightId));
Project project = assertProjectExists(resourceId);
assertIamBindingsContains(project, IAM_BINDINGS);
assertNetworkExists(project);
assertSubnetsExist(project, NetworkMonitoring.ENABLED);
assertRouteExists(project);
assertDnsExists(project);
}
use of bio.terra.buffer.service.resource.FlightManager in project terra-resource-buffer by DataBiosphere.
the class CreateProjectFlightIntegrationTest method testCreateGoogleProject_enablePrivateGoogleAccessAndFlowLog.
@Test
public void testCreateGoogleProject_enablePrivateGoogleAccessAndFlowLog() throws Exception {
FlightManager manager = new FlightManager(bufferDao, flightSubmissionFactoryImpl, stairwayComponent, transactionTemplate);
Pool pool = preparePool(bufferDao, newBasicGcpConfig().network(new bio.terra.buffer.generated.model.Network().enableNetworkMonitoring(true).enablePrivateGoogleAccess(true)));
String flightId = manager.submitCreationFlight(pool).get();
ResourceId resourceId = extractResourceIdFromFlightState(blockUntilFlightComplete(stairwayComponent, flightId));
Project project = assertProjectExists(resourceId);
assertNetworkExists(project);
assertSubnetsExist(project, NetworkMonitoring.ENABLED);
assertRouteExists(project);
assertDnsExists(project);
assertDefaultVpcNotExists(project);
}
use of bio.terra.buffer.service.resource.FlightManager in project terra-resource-buffer by DataBiosphere.
the class CreateProjectFlightIntegrationTest method errorCreateProject_noRollbackAfterResourceReady.
@Test
public void errorCreateProject_noRollbackAfterResourceReady() throws Exception {
// Verify project and db entity won't get deleted if resource id READY, even the flight fails.
FlightManager manager = new FlightManager(bufferDao, new StubSubmissionFlightFactory(ErrorAfterCreateResourceFlight.class), stairwayComponent, transactionTemplate);
Pool pool = preparePool(bufferDao, newBasicGcpConfig());
String flightId = manager.submitCreationFlight(pool).get();
extractResourceIdFromFlightState(blockUntilFlightComplete(stairwayComponent, flightId));
Resource resource = bufferDao.retrieveResourcesRandomly(pool.id(), ResourceState.READY, 1).get(0);
assertEquals("ACTIVE", rmCow.projects().get(resource.cloudResourceUid().getGoogleProjectUid().getProjectId()).execute().getState());
assertEquals(FlightStatus.ERROR, stairwayComponent.get().getFlightState(flightId).getFlightStatus());
}
Aggregations