Search in sources :

Example 11 with StackGresDbOpsReview

use of io.stackgres.operator.common.StackGresDbOpsReview in project stackgres by ongres.

the class DbOpsRepackConstraintValidatorTest method nullVacuum_shouldPass.

@Test
void nullVacuum_shouldPass() throws ValidationFailed {
    StackGresDbOpsReview review = getValidReview();
    review.getRequest().getObject().getSpec().setBenchmark(null);
    validator.validate(review);
}
Also used : StackGresDbOpsReview(io.stackgres.operator.common.StackGresDbOpsReview) Test(org.junit.jupiter.api.Test) ConstraintValidationTest(io.stackgres.operator.validation.ConstraintValidationTest)

Example 12 with StackGresDbOpsReview

use of io.stackgres.operator.common.StackGresDbOpsReview in project stackgres by ongres.

the class DbOpsSecurityUpgradeValidatorTest method givenValidStackGresVersionOnCreation_shouldNotFail.

@Test
void givenValidStackGresVersionOnCreation_shouldNotFail() throws ValidationFailed {
    final StackGresDbOpsReview review = getCreationReview();
    String sgcluster = review.getRequest().getObject().getSpec().getSgCluster();
    String namespace = review.getRequest().getObject().getMetadata().getNamespace();
    when(clusterFinder.findByNameAndNamespace(sgcluster, namespace)).thenReturn(Optional.of(cluster));
    validator.validate(review);
    verify(clusterFinder).findByNameAndNamespace(eq(sgcluster), eq(namespace));
}
Also used : StackGresDbOpsReview(io.stackgres.operator.common.StackGresDbOpsReview) Test(org.junit.jupiter.api.Test)

Example 13 with StackGresDbOpsReview

use of io.stackgres.operator.common.StackGresDbOpsReview in project stackgres by ongres.

the class DbOpsConstraintValidatorTest method negativeTimeout_shouldFail.

@Test
void negativeTimeout_shouldFail() {
    StackGresDbOpsReview review = getValidReview();
    review.getRequest().getObject().getSpec().setTimeout("-PT1M");
    checkErrorCause(StackGresDbOpsSpec.class, "spec.timeout", "spec.isTimeoutValid", review, AssertTrue.class);
}
Also used : StackGresDbOpsReview(io.stackgres.operator.common.StackGresDbOpsReview) Test(org.junit.jupiter.api.Test) ConstraintValidationTest(io.stackgres.operator.validation.ConstraintValidationTest)

Example 14 with StackGresDbOpsReview

use of io.stackgres.operator.common.StackGresDbOpsReview in project stackgres by ongres.

the class DbOpsConstraintValidatorTest method wrongTimeout_shouldFail.

@Test
void wrongTimeout_shouldFail() {
    StackGresDbOpsReview review = getValidReview();
    review.getRequest().getObject().getSpec().setTimeout("10s");
    checkErrorCause(StackGresDbOpsSpec.class, "spec.timeout", "spec.isTimeoutValid", review, AssertTrue.class);
}
Also used : StackGresDbOpsReview(io.stackgres.operator.common.StackGresDbOpsReview) Test(org.junit.jupiter.api.Test) ConstraintValidationTest(io.stackgres.operator.validation.ConstraintValidationTest)

Example 15 with StackGresDbOpsReview

use of io.stackgres.operator.common.StackGresDbOpsReview in project stackgres by ongres.

the class DbOpsConstraintValidatorTest method wrongOp_shouldFail.

@Test
void wrongOp_shouldFail() {
    StackGresDbOpsReview review = getValidReview();
    review.getRequest().getObject().getSpec().setOp("test");
    checkErrorCause(StackGresDbOpsSpec.class, "spec.op", "spec.isOpValid", review, AssertTrue.class);
}
Also used : StackGresDbOpsReview(io.stackgres.operator.common.StackGresDbOpsReview) Test(org.junit.jupiter.api.Test) ConstraintValidationTest(io.stackgres.operator.validation.ConstraintValidationTest)

Aggregations

StackGresDbOpsReview (io.stackgres.operator.common.StackGresDbOpsReview)28 Test (org.junit.jupiter.api.Test)24 ConstraintValidationTest (io.stackgres.operator.validation.ConstraintValidationTest)22 ValidationFailed (io.stackgres.operatorframework.admissionwebhook.validating.ValidationFailed)2