Search in sources :

Example 1 with GcpProjectConfig

use of bio.terra.buffer.generated.model.GcpProjectConfig in project terra-resource-buffer by DataBiosphere.

the class PoolServiceTest method updateFromConfig_updateResourceConfigOnExistingPool_throwsException.

@Test
public void updateFromConfig_updateResourceConfigOnExistingPool_throwsException() throws Exception {
    PoolId poolId = PoolId.create("poolId");
    PoolConfig poolConfig = new PoolConfig().poolId(poolId.toString()).size(1).resourceConfigName(RESOURCE_CONFIG_NAME);
    PoolWithResourceConfig parsedPoolConfig = PoolWithResourceConfig.create(poolConfig, newResourceConfig());
    poolService.updateFromConfig(ImmutableList.of(parsedPoolConfig));
    // Sets ResourceConfig's GCP project id prefix to newer value.
    PoolWithResourceConfig updatedPoolConfig = PoolWithResourceConfig.create(poolConfig, newResourceConfig(new GcpProjectConfig().projectIdSchema(new ProjectIdSchema().prefix("aou-rw-test2").scheme(ProjectIdSchema.SchemeEnum.RANDOM_CHAR))));
    assertThrows(RuntimeException.class, () -> poolService.updateFromConfig(ImmutableList.of(updatedPoolConfig)));
    assertThat(bufferDao.retrievePools().stream().map(Pool::resourceConfig).collect(Collectors.toList()), Matchers.containsInAnyOrder(parsedPoolConfig.resourceConfig()));
}
Also used : PoolId(bio.terra.buffer.common.PoolId) ProjectIdSchema(bio.terra.buffer.generated.model.ProjectIdSchema) GcpProjectConfig(bio.terra.buffer.generated.model.GcpProjectConfig) PoolConfig(bio.terra.buffer.generated.model.PoolConfig) Pool(bio.terra.buffer.common.Pool) BaseUnitTest(bio.terra.buffer.common.BaseUnitTest) Test(org.junit.jupiter.api.Test)

Example 2 with GcpProjectConfig

use of bio.terra.buffer.generated.model.GcpProjectConfig in project terra-resource-buffer by DataBiosphere.

the class GoogleProjectConfigUtilsTest method userPrivateGoogleAccess.

@Test
public void userPrivateGoogleAccess() throws Exception {
    GcpProjectConfig gcpProjectConfig = new GcpProjectConfig().network(new Network().enablePrivateGoogleAccess(false));
    assertFalse(GoogleProjectConfigUtils.usePrivateGoogleAccess(gcpProjectConfig));
    gcpProjectConfig.setNetwork(gcpProjectConfig.getNetwork().enableNetworkMonitoring(true));
    assertTrue(GoogleProjectConfigUtils.usePrivateGoogleAccess(gcpProjectConfig));
}
Also used : GcpProjectConfig(bio.terra.buffer.generated.model.GcpProjectConfig) Network(bio.terra.buffer.generated.model.Network) Test(org.junit.jupiter.api.Test) BaseUnitTest(bio.terra.buffer.common.BaseUnitTest)

Aggregations

BaseUnitTest (bio.terra.buffer.common.BaseUnitTest)2 GcpProjectConfig (bio.terra.buffer.generated.model.GcpProjectConfig)2 Test (org.junit.jupiter.api.Test)2 Pool (bio.terra.buffer.common.Pool)1 PoolId (bio.terra.buffer.common.PoolId)1 Network (bio.terra.buffer.generated.model.Network)1 PoolConfig (bio.terra.buffer.generated.model.PoolConfig)1 ProjectIdSchema (bio.terra.buffer.generated.model.ProjectIdSchema)1