use of com.blackducksoftware.bdio2.model.Project 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 com.blackducksoftware.bdio2.model.Project 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 com.blackducksoftware.bdio2.model.Project in project terra-resource-buffer by DataBiosphere.
the class CreateProjectFlightIntegrationTest method assertDnsExists.
private void assertDnsExists(Project project) throws Exception {
String projectId = project.getProjectId();
ManagedZone managedZone = dnsCow.managedZones().get(projectId, MANAGED_ZONE_NAME).execute();
Map<String, ResourceRecordSet> resourceRecordSets = dnsCow.resourceRecordSets().list(project.getProjectId(), MANAGED_ZONE_NAME).execute().getRrsets().stream().collect(Collectors.toMap(ResourceRecordSet::getType, r -> r));
ResourceRecordSet aRecordSet = resourceRecordSets.get(RESTRICT_API_A_RECORD.getType());
ResourceRecordSet cnameRecordSet = resourceRecordSets.get(RESTRICT_API_CNAME_RECORD.getType());
assertEquals(MANAGED_ZONE_TEMPLATE.getName(), managedZone.getName());
assertEquals(MANAGED_ZONE_TEMPLATE.getVisibility(), managedZone.getVisibility().toLowerCase());
assertEquals(MANAGED_ZONE_TEMPLATE.getDescription(), managedZone.getDescription());
assertResourceRecordSetMatch(RESTRICT_API_A_RECORD, aRecordSet);
assertResourceRecordSetMatch(RESTRICT_API_CNAME_RECORD, cnameRecordSet);
}
use of com.blackducksoftware.bdio2.model.Project 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 com.blackducksoftware.bdio2.model.Project in project terra-resource-buffer by DataBiosphere.
the class CreateProjectFlightIntegrationTest method assertProjectExists.
private Project assertProjectExists(ResourceId resourceId) throws Exception {
Resource resource = bufferDao.retrieveResource(resourceId).get();
Project project = rmCow.projects().get(resource.cloudResourceUid().getGoogleProjectUid().getProjectId()).execute();
assertEquals("ACTIVE", project.getState());
assertThat(project.getLabels().entrySet(), Matchers.hasItems(Map.entry(NETWORK_LABEL_KEY, NETWORK_NAME), Map.entry(SUB_NETWORK_LABEL_KEY, SUBNETWORK_NAME), Map.entry(LEONARDO_ALLOW_HTTPS_FIREWALL_RULE_NAME_LABEL_KEY, LEONARDO_SSL_FOR_VPC_NETWORK_RULE_NAME), Map.entry(LEONARDO_ALLOW_INTERNAL_RULE_NAME_LABEL_KEY, ALLOW_INTERNAL_FOR_VPC_NETWORK_RULE_NAME), Map.entry(CONFIG_NAME_LABEL_KEY, TEST_CONFIG_NAME)));
return project;
}
Aggregations