use of io.stackgres.operator.common.PgConfigReview in project stackgres by ongres.
the class PgConfigDefaultValuesMutatorTest method getEmptyReview.
@Override
protected PgConfigReview getEmptyReview() {
PgConfigReview review = JsonUtil.readFromJson("pgconfig_allow_request/valid_pgconfig.json", PgConfigReview.class);
review.getRequest().getObject().getSpec().setPostgresqlConf(new HashMap<>());
return review;
}
use of io.stackgres.operator.common.PgConfigReview in project stackgres by ongres.
the class BlocklistValidatorTest method givenValidConfigurationUpdate_shouldNotFail.
@Test
void givenValidConfigurationUpdate_shouldNotFail() throws ValidationFailed {
PgConfigReview review = JsonUtil.readFromJson("pgconfig_allow_request/valid_pgconfig_update.json", PgConfigReview.class);
validator.validate(review);
}
use of io.stackgres.operator.common.PgConfigReview in project stackgres by ongres.
the class BlocklistValidatorTest method givenUpdateWithBlocklistedProperties_shouldFail.
@Test
void givenUpdateWithBlocklistedProperties_shouldFail() {
PgConfigReview review = JsonUtil.readFromJson("pgconfig_allow_request/valid_pgconfig_update.json", PgConfigReview.class);
StackGresPostgresConfig pgConfig = review.getRequest().getObject();
String[] blocklistedProperties = addBlocklistProperties(pgConfig);
assertThrows(ValidationFailed.class, () -> {
validator.validate(review);
});
ValidationFailed ex = assertThrows(ValidationFailed.class, () -> {
validator.validate(review);
});
String errorMessage = ex.getResult().getMessage();
assertEquals("Invalid postgres configuration, properties: " + String.join(", ", blocklistedProperties) + " cannot be settled", errorMessage);
}
use of io.stackgres.operator.common.PgConfigReview in project stackgres by ongres.
the class PgConfigConstraintValidatorTest method getInvalidReview.
@Override
protected PgConfigReview getInvalidReview() {
final PgConfigReview review = JsonUtil.readFromJson("pgconfig_allow_request/valid_pgconfig_update.json", PgConfigReview.class);
review.getRequest().getObject().setSpec(null);
return review;
}
use of io.stackgres.operator.common.PgConfigReview in project stackgres by ongres.
the class BlocklistValidatorTest method givenCreationWithBlocklistedProperties_shouldFail.
@Test
void givenCreationWithBlocklistedProperties_shouldFail() {
PgConfigReview review = JsonUtil.readFromJson("pgconfig_allow_request/valid_pgconfig.json", PgConfigReview.class);
StackGresPostgresConfig pgConfig = review.getRequest().getObject();
String[] blocklistedProperties = addBlocklistProperties(pgConfig);
ValidationFailed ex = assertThrows(ValidationFailed.class, () -> {
validator.validate(review);
});
String errorMessage = ex.getResult().getMessage();
assertEquals("Invalid postgres configuration, properties: " + String.join(", ", blocklistedProperties) + " cannot be settled", errorMessage);
}
Aggregations