use of bio.terra.buffer.common.ResourceId in project terra-resource-buffer by DataBiosphere.
the class CreateProjectFlightIntegrationTest method testCreateGoogleProject_keepDefaultComputeEngineServiceAcct.
@Test
public void testCreateGoogleProject_keepDefaultComputeEngineServiceAcct() throws Exception {
FlightManager manager = new FlightManager(bufferDao, flightSubmissionFactoryImpl, stairwayComponent, transactionTemplate);
Pool pool = preparePool(bufferDao, newBasicGcpConfig().computeEngine(new ComputeEngine().keepDefaultServiceAcct(true)));
String flightId = manager.submitCreationFlight(pool).get();
ResourceId resourceId = extractResourceIdFromFlightState(blockUntilFlightComplete(stairwayComponent, flightId));
Project project = assertProjectExists(resourceId);
assertDefaultServiceAccountExists(project);
}
use of bio.terra.buffer.common.ResourceId in project terra-resource-buffer by DataBiosphere.
the class CreateProjectFlightIntegrationTest method testCreateGoogleProject_basicCreation.
@Test
public void testCreateGoogleProject_basicCreation() throws Exception {
FlightManager manager = new FlightManager(bufferDao, flightSubmissionFactoryImpl, stairwayComponent, transactionTemplate);
Pool pool = preparePool(bufferDao, newBasicGcpConfig());
String flightId = manager.submitCreationFlight(pool).get();
ResourceId resourceId = extractResourceIdFromFlightState(blockUntilFlightComplete(stairwayComponent, flightId));
Project project = assertProjectExists(resourceId);
assertBillingIs(project, pool.resourceConfig().getGcpProjectConfig().getBillingAccount());
assertEnableApisContains(project, pool.resourceConfig().getGcpProjectConfig().getEnabledApis());
assertLogStorageBucketExists(project);
assertNetworkExists(project);
assertFirewallRulesExist(project);
assertSubnetsExist(project, NetworkMonitoring.DISABLED);
assertRouteNotExists(project);
assertDnsNotExists(project);
assertDefaultVpcNotExists(project);
assertDefaultServiceAccountNotExists(project);
String logBucketName = "storage-logs-" + project.getProjectId();
assertNotNull(storageCow.get(logBucketName));
}
use of bio.terra.buffer.common.ResourceId in project terra-resource-buffer by DataBiosphere.
the class DeleteProjectFlightIntegrationTest method testDeleteGoogleProject_errorWhenResourceStateChange.
@Test
public void testDeleteGoogleProject_errorWhenResourceStateChange() throws Exception {
LatchStep.startNewLatch();
Pool pool = preparePool(bufferDao, newBasicGcpConfig());
ResourceId resourceId = ResourceId.create(UUID.randomUUID());
bufferDao.createResource(Resource.builder().id(resourceId).poolId(pool.id()).creation(Instant.now()).state(ResourceState.READY).build());
Resource resource = bufferDao.retrieveResource(resourceId).get();
FlightManager manager = new FlightManager(bufferDao, new StubSubmissionFlightFactory(LatchBeforeAssertResourceStep.class), stairwayComponent, transactionTemplate);
String deleteFlightId = manager.submitDeletionFlight(resource, ResourceType.GOOGLE_PROJECT).get();
// Delete the resource from DB.
assertTrue(bufferDao.deleteResource(resource.id()));
// Release the latch, and resume the flight, assert flight failed.
LatchStep.releaseLatch();
extractResourceIdFromFlightState(blockUntilFlightComplete(stairwayComponent, deleteFlightId));
// Resource is deleted.
assertFalse(bufferDao.retrieveResource(resource.id()).isPresent());
assertEquals(FlightStatus.ERROR, stairwayComponent.get().getFlightState(deleteFlightId).getFlightStatus());
}
Aggregations