Search in sources :

Example 1 with InvalidPoolConfigException

use of bio.terra.buffer.common.exception.InvalidPoolConfigException 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"));
}
Also used : ProjectIdSchema(bio.terra.buffer.generated.model.ProjectIdSchema) ResourceConfig(bio.terra.buffer.generated.model.ResourceConfig) InvalidPoolConfigException(bio.terra.buffer.common.exception.InvalidPoolConfigException) Test(org.junit.jupiter.api.Test) BaseUnitTest(bio.terra.buffer.common.BaseUnitTest)

Example 2 with InvalidPoolConfigException

use of bio.terra.buffer.common.exception.InvalidPoolConfigException 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"));
}
Also used : ResourceConfig(bio.terra.buffer.generated.model.ResourceConfig) InvalidPoolConfigException(bio.terra.buffer.common.exception.InvalidPoolConfigException) Test(org.junit.jupiter.api.Test) BaseUnitTest(bio.terra.buffer.common.BaseUnitTest)

Aggregations

BaseUnitTest (bio.terra.buffer.common.BaseUnitTest)2 InvalidPoolConfigException (bio.terra.buffer.common.exception.InvalidPoolConfigException)2 ResourceConfig (bio.terra.buffer.generated.model.ResourceConfig)2 Test (org.junit.jupiter.api.Test)2 ProjectIdSchema (bio.terra.buffer.generated.model.ProjectIdSchema)1