use of com.google.api.services.cloudresourcemanager.v3.model.Project in project terra-resource-buffer by DataBiosphere.
the class CreateProjectFlightIntegrationTest method testCreateGoogleProject_witIamBindings.
@Test
public void testCreateGoogleProject_witIamBindings() throws Exception {
// Basic GCP project with IAM Bindings
FlightManager manager = new FlightManager(bufferDao, flightSubmissionFactoryImpl, stairwayComponent, transactionTemplate);
Pool pool = preparePool(bufferDao, newBasicGcpConfig().iamBindings(IAM_BINDINGS).kubernetesEngine(new KubernetesEngine().createGkeDefaultServiceAccount(true)));
String flightId = manager.submitCreationFlight(pool).get();
ResourceId resourceId = extractResourceIdFromFlightState(blockUntilFlightComplete(stairwayComponent, flightId));
Project project = assertProjectExists(resourceId);
assertIamBindingsContains(project, IAM_BINDINGS);
}
use of com.google.api.services.cloudresourcemanager.v3.model.Project 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 com.google.api.services.cloudresourcemanager.v3.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.google.api.services.cloudresourcemanager.v3.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.google.api.services.cloudresourcemanager.v3.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);
}
Aggregations