use of io.stackgres.operator.common.PoolingReview in project stackgres by ongres.
the class PoolingBlocklistValidatorTest method givenConfigurationWithDatabasesBlockedParameters_shouldFail.
@Test
void givenConfigurationWithDatabasesBlockedParameters_shouldFail() {
PoolingReview review = getCreatePoolingReview();
var pgBouncer = review.getRequest().getObject().getSpec().getPgBouncer();
pgBouncer.getPgbouncerIni().setDatabases(new HashMap<>());
pgBouncer.getPgbouncerIni().getDatabases().put("foodb", Map.of("user", "user1", "host", "example.com"));
ValidationFailed assertThrows = assertThrows(ValidationFailed.class, () -> validator.validate(review));
assertEquals("Invalid PgBouncer configuration, properties: [host, user] cannot be set", assertThrows.getMessage());
}
use of io.stackgres.operator.common.PoolingReview in project stackgres by ongres.
the class PoolingConstraintValidatorTest method nullSpec_shouldFail.
@Test
void nullSpec_shouldFail() {
PoolingReview review = getInvalidReview();
checkNotNullErrorCause(StackGresPoolingConfig.class, "spec", review);
}
use of io.stackgres.operator.common.PoolingReview in project stackgres by ongres.
the class PoolingConstraintValidatorTest method emptyPgBouncerConf_shouldFail.
@Test
void emptyPgBouncerConf_shouldFail() {
PoolingReview review = getValidReview();
review.getRequest().getObject().getSpec().getPgBouncer().getPgbouncerIni().setParameters(Map.of());
checkNotEmptyErrorCause(StackGresPoolingConfigPgBouncerPgbouncerIni.class, "spec.pgBouncer.pgbouncerIni.parameters", review);
}
use of io.stackgres.operator.common.PoolingReview in project stackgres by ongres.
the class PoolingValidationPipelineTest method getConstraintViolatingReview.
@Override
public PoolingReview getConstraintViolatingReview() {
PoolingReview review = getValidReview();
review.getRequest().getObject().getSpec().getPgBouncer().getPgbouncerIni().setParameters(Map.of());
return review;
}
use of io.stackgres.operator.common.PoolingReview in project stackgres by ongres.
the class PoolingBlocklistValidatorTest method givenValidConfigurationWithDatabases_shouldNotFail.
@Test
void givenValidConfigurationWithDatabases_shouldNotFail() {
PoolingReview review = getCreatePoolingReview();
var pgBouncer = review.getRequest().getObject().getSpec().getPgBouncer();
pgBouncer.getPgbouncerIni().setDatabases(new HashMap<>());
pgBouncer.getPgbouncerIni().getDatabases().put("foodb", Map.of("dbname", "bardb"));
assertDoesNotThrow(() -> validator.validate(review));
}
Aggregations