Search in sources :

Example 21 with StackGresDbOpsReview

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

the class DbOpsConstraintValidatorTest method nullOp_shouldFail.

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

Example 22 with StackGresDbOpsReview

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

the class DbOpsConstraintValidatorTest method invalidLowMaxRetries_shouldFail.

@Test
void invalidLowMaxRetries_shouldFail() {
    StackGresDbOpsReview review = getValidReview();
    review.getRequest().getObject().getSpec().setMaxRetries(-1);
    checkErrorCause(StackGresDbOpsSpec.class, "spec.maxRetries", review, Min.class);
}
Also used : StackGresDbOpsReview(io.stackgres.operator.common.StackGresDbOpsReview) Test(org.junit.jupiter.api.Test) ConstraintValidationTest(io.stackgres.operator.validation.ConstraintValidationTest)

Example 23 with StackGresDbOpsReview

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

the class DbOpsConstraintValidatorTest method invalidHighMaxRetries_shouldFail.

@Test
void invalidHighMaxRetries_shouldFail() {
    StackGresDbOpsReview review = getValidReview();
    review.getRequest().getObject().getSpec().setMaxRetries(11);
    checkErrorCause(StackGresDbOpsSpec.class, "spec.maxRetries", review, Max.class);
}
Also used : StackGresDbOpsReview(io.stackgres.operator.common.StackGresDbOpsReview) Test(org.junit.jupiter.api.Test) ConstraintValidationTest(io.stackgres.operator.validation.ConstraintValidationTest)

Example 24 with StackGresDbOpsReview

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

the class DbOpsPgbenchConstraintValidatorTest method nullBenchmarkPgbenchDatabaseSize_shouldFail.

@Test
void nullBenchmarkPgbenchDatabaseSize_shouldFail() {
    StackGresDbOpsReview review = getValidReview();
    review.getRequest().getObject().getSpec().getBenchmark().getPgbench().setDatabaseSize(null);
    checkErrorCause(StackGresDbOpsPgbench.class, "spec.benchmark.pgbench.databaseSize", review, NotNull.class);
}
Also used : StackGresDbOpsReview(io.stackgres.operator.common.StackGresDbOpsReview) Test(org.junit.jupiter.api.Test) ConstraintValidationTest(io.stackgres.operator.validation.ConstraintValidationTest)

Example 25 with StackGresDbOpsReview

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

the class DbOpsPgbenchConstraintValidatorTest method negativeDuration_shouldFail.

@Test
void negativeDuration_shouldFail() {
    StackGresDbOpsReview review = getValidReview();
    review.getRequest().getObject().getSpec().getBenchmark().getPgbench().setDuration("-PT1M");
    checkErrorCause(StackGresDbOpsPgbench.class, "spec.benchmark.pgbench.duration", "spec.benchmark.pgbench.isDurationValid", 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