Search in sources :

Example 36 with Project

use of com.blackducksoftware.bdio2.model.Project in project terra-resource-buffer by DataBiosphere.

the class BufferIntegrationTest method assertProjectMatch.

private void assertProjectMatch(CloudResourceUid resourceUid, GcpProjectConfig gcpProjectConfig) throws Exception {
    Project project = rmCow.projects().get(resourceUid.getGoogleProjectUid().getProjectId()).execute();
    assertEquals("ACTIVE", project.getState());
}
Also used : Project(com.google.api.services.cloudresourcemanager.v3.model.Project)

Example 37 with Project

use of com.blackducksoftware.bdio2.model.Project in project terra-resource-buffer by DataBiosphere.

the class CreateProjectFlightIntegrationTest method testCreateGoogleProject_createGkeSA_true.

@Test
public void testCreateGoogleProject_createGkeSA_true() throws Exception {
    FlightManager manager = new FlightManager(bufferDao, flightSubmissionFactoryImpl, stairwayComponent, transactionTemplate);
    Pool pool = preparePool(bufferDao, newBasicGcpConfig().kubernetesEngine(new KubernetesEngine().createGkeDefaultServiceAccount(true)));
    String flightId = manager.submitCreationFlight(pool).get();
    ResourceId resourceId = extractResourceIdFromFlightState(blockUntilFlightComplete(stairwayComponent, flightId));
    Project project = assertProjectExists(resourceId);
    String projectId = project.getProjectId();
    String serviceAccountEmail = ServiceAccountName.emailFromAccountId(GKE_SA_NAME, projectId);
    assertServiceAccountExists(project, serviceAccountEmail);
    List<IamBinding> expectedGkeSABindings = new ArrayList<>();
    GKE_SA_ROLES.forEach(r -> expectedGkeSABindings.add(new IamBinding().role(r).addMembersItem("serviceAccount:" + serviceAccountEmail)));
    assertIamBindingsContains(project, expectedGkeSABindings);
}
Also used : Project(com.google.api.services.cloudresourcemanager.v3.model.Project) ResourceId(bio.terra.buffer.common.ResourceId) ArrayList(java.util.ArrayList) Pool(bio.terra.buffer.common.Pool) IntegrationUtils.preparePool(bio.terra.buffer.integration.IntegrationUtils.preparePool) FlightManager(bio.terra.buffer.service.resource.FlightManager) Test(org.junit.jupiter.api.Test) BaseIntegrationTest(bio.terra.buffer.common.BaseIntegrationTest)

Example 38 with Project

use of com.blackducksoftware.bdio2.model.Project in project terra-resource-buffer by DataBiosphere.

the class CreateProjectFlightIntegrationTest method testCreateGoogleProject_blockInternetAccessWithGcrDnsEnabled.

@Test
public void testCreateGoogleProject_blockInternetAccessWithGcrDnsEnabled() 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).enableCloudRegistryPrivateGoogleAccess(true).blockBatchInternetAccess(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);
    assertGcrDnsExists(project);
    assertDefaultVpcNotExists(project);
    assertFirewallRulesExistForBlockInternetAccess(project);
}
Also used : Project(com.google.api.services.cloudresourcemanager.v3.model.Project) ResourceId(bio.terra.buffer.common.ResourceId) Network(com.google.api.services.compute.model.Network) Pool(bio.terra.buffer.common.Pool) IntegrationUtils.preparePool(bio.terra.buffer.integration.IntegrationUtils.preparePool) FlightManager(bio.terra.buffer.service.resource.FlightManager) Test(org.junit.jupiter.api.Test) BaseIntegrationTest(bio.terra.buffer.common.BaseIntegrationTest)

Example 39 with Project

use of com.blackducksoftware.bdio2.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);
}
Also used : Project(com.google.api.services.cloudresourcemanager.v3.model.Project) ResourceId(bio.terra.buffer.common.ResourceId) Pool(bio.terra.buffer.common.Pool) IntegrationUtils.preparePool(bio.terra.buffer.integration.IntegrationUtils.preparePool) FlightManager(bio.terra.buffer.service.resource.FlightManager) Test(org.junit.jupiter.api.Test) BaseIntegrationTest(bio.terra.buffer.common.BaseIntegrationTest)

Example 40 with Project

use of com.blackducksoftware.bdio2.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));
}
Also used : Project(com.google.api.services.cloudresourcemanager.v3.model.Project) ResourceId(bio.terra.buffer.common.ResourceId) Pool(bio.terra.buffer.common.Pool) IntegrationUtils.preparePool(bio.terra.buffer.integration.IntegrationUtils.preparePool) FlightManager(bio.terra.buffer.service.resource.FlightManager) Test(org.junit.jupiter.api.Test) BaseIntegrationTest(bio.terra.buffer.common.BaseIntegrationTest)

Aggregations

Project (com.google.api.services.cloudresourcemanager.v3.model.Project)38 Test (org.junit.jupiter.api.Test)32 BaseIntegrationTest (bio.terra.buffer.common.BaseIntegrationTest)15 Pool (bio.terra.buffer.common.Pool)15 ResourceId (bio.terra.buffer.common.ResourceId)15 IntegrationUtils.preparePool (bio.terra.buffer.integration.IntegrationUtils.preparePool)15 FlightManager (bio.terra.buffer.service.resource.FlightManager)15 StepStatus (bio.terra.stairway.StepStatus)9 BaseConnectedTest (bio.terra.workspace.common.BaseConnectedTest)8 List (java.util.List)8 DisabledIfEnvironmentVariable (org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable)8 FlightDebugInfo (bio.terra.stairway.FlightDebugInfo)7 FlightState (bio.terra.stairway.FlightState)7 AuthenticatedUserRequest (bio.terra.workspace.service.iam.AuthenticatedUserRequest)7 IOException (java.io.IOException)7 ArrayList (java.util.ArrayList)7 Project (com.blackducksoftware.bdio2.model.Project)6 UUID (java.util.UUID)6 Resource (bio.terra.buffer.common.Resource)5 bio.terra.buffer.generated.model (bio.terra.buffer.generated.model)5