use of io.stackgres.operator.common.StackGresDbOpsReview in project stackgres by ongres.
the class DbOpsSecurityUpgradeValidatorTest method givenInvalidStackGresVersionOnCreation_shouldFail.
@Test
void givenInvalidStackGresVersionOnCreation_shouldFail() {
final StackGresDbOpsReview review = getCreationReview();
String sgcluster = review.getRequest().getObject().getSpec().getSgCluster();
String namespace = review.getRequest().getObject().getMetadata().getNamespace();
cluster.getSpec().getPostgres().setVersion("11.11");
when(clusterFinder.findByNameAndNamespace(sgcluster, namespace)).thenReturn(Optional.of(cluster));
ValidationFailed ex = assertThrows(ValidationFailed.class, () -> {
validator.validate(review);
});
String resultMessage = ex.getMessage();
assertEquals("Major version upgrade must be performed on StackGresCluster before performing" + " the upgrade since Postgres version 11.11 will not be" + " supported after the upgrade is completed", resultMessage);
}
use of io.stackgres.operator.common.StackGresDbOpsReview in project stackgres by ongres.
the class DbOpsVacuumConstraintValidatorTest method nullVacuum_shouldPass.
@Test
void nullVacuum_shouldPass() throws ValidationFailed {
StackGresDbOpsReview review = getValidReview();
review.getRequest().getObject().getSpec().setBenchmark(null);
validator.validate(review);
}
use of io.stackgres.operator.common.StackGresDbOpsReview in project stackgres by ongres.
the class DbOpsVacuumConstraintValidatorTest method getInvalidReview.
@Override
protected StackGresDbOpsReview getInvalidReview() {
final StackGresDbOpsReview review = JsonUtil.readFromJson("dbops_allow_requests/valid_vacuum_creation.json", StackGresDbOpsReview.class);
review.getRequest().getObject().setSpec(null);
return review;
}
Aggregations