use of bio.terra.buffer.generated.model.ResourceConfig in project terra-resource-buffer by DataBiosphere.
the class PoolConfigLoaderTest method combineParsedResult_resourceConfigNotFound.
@Test
public void combineParsedResult_resourceConfigNotFound() {
String resourceConfigName = "configName";
PoolConfig poolConfig = new PoolConfig().poolId("id").resourceConfigName("badName");
PoolConfigs pools = new PoolConfigs().poolConfigs(ImmutableList.of(poolConfig, poolConfig));
ResourceConfig resourceConfig = new ResourceConfig().configName(resourceConfigName);
assertThrows(BadPoolConfigException.class, () -> combineParsedConfig(pools, ImmutableMap.of(resourceConfigName, resourceConfig)));
}
use of bio.terra.buffer.generated.model.ResourceConfig in project terra-resource-buffer by DataBiosphere.
the class PoolServiceTest method newReadyPool.
/**
* Creates a pool with resources with given size.
*/
private void newReadyPool(PoolId poolId, int poolSize) {
Pool pool = Pool.builder().creation(Instant.now()).id(poolId).resourceType(ResourceType.GOOGLE_PROJECT).size(poolSize).resourceConfig(new ResourceConfig().configName("resourceName")).status(PoolStatus.ACTIVE).build();
bufferDao.createPools(ImmutableList.of(pool));
for (int i = 0; i < poolSize; i++) {
ResourceId id = ResourceId.create(UUID.randomUUID());
bufferDao.createResource(Resource.builder().id(id).poolId(poolId).creation(Instant.now()).state(ResourceState.CREATING).build());
bufferDao.updateResourceAsReady(id, newProjectUid());
}
}
use of bio.terra.buffer.generated.model.ResourceConfig in project terra-resource-buffer by DataBiosphere.
the class ResourceConfigValidatorTest method testValidateGcpConfig_prefixTooLong.
@Test
public void testValidateGcpConfig_prefixTooLong() {
ResourceConfig resourceConfig = new ResourceConfig().configName("testConfig").gcpProjectConfig(newValidGcpProjectConfig().projectIdSchema(new ProjectIdSchema().prefix("prefixlongerthan12characters").scheme(ProjectIdSchema.SchemeEnum.TWO_WORDS_NUMBER)));
InvalidPoolConfigException exception = assertThrows(InvalidPoolConfigException.class, () -> new GcpResourceConfigValidator().validate(resourceConfig));
assertTrue(exception.getMessage().contains("Project id prefix is too long for TWO_WORDS_NUMBER naming scheme"));
}
use of bio.terra.buffer.generated.model.ResourceConfig in project terra-resource-buffer by DataBiosphere.
the class ResourceConfigValidatorTest method testValidateGcpConfig_missingBillingAccount.
@Test
public void testValidateGcpConfig_missingBillingAccount() {
ResourceConfig resourceConfig = new ResourceConfig().configName("testConfig").gcpProjectConfig(newValidGcpProjectConfig().billingAccount(""));
InvalidPoolConfigException exception = assertThrows(InvalidPoolConfigException.class, () -> new GcpResourceConfigValidator().validate(resourceConfig));
assertTrue(exception.getMessage().contains("Missing billing account"));
}
use of bio.terra.buffer.generated.model.ResourceConfig in project terra-resource-buffer by DataBiosphere.
the class ResourceConfigValidatorTest method testValidateGcpConfig_success.
@Test
public void testValidateGcpConfig_success() {
ResourceConfig resourceConfig = new ResourceConfig().configName("testConfig").gcpProjectConfig(newValidGcpProjectConfig());
new GcpResourceConfigValidator().validate(resourceConfig);
}
Aggregations