Search in sources :

Example 1 with StackGresDbOpsReview

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

the class DbOpsPgbenchConstraintValidatorTest method nullBenchmark_shouldFail.

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

Example 2 with StackGresDbOpsReview

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

the class DbOpsPgbenchConstraintValidatorTest method wrongBenchmarkType_shouldFail.

@Test
void wrongBenchmarkType_shouldFail() {
    StackGresDbOpsReview review = getValidReview();
    review.getRequest().getObject().getSpec().getBenchmark().setType("test");
    checkErrorCause(StackGresDbOpsBenchmark.class, "spec.benchmark.type", "spec.isTypeValid", review, AssertTrue.class);
}
Also used : StackGresDbOpsReview(io.stackgres.operator.common.StackGresDbOpsReview) Test(org.junit.jupiter.api.Test) ConstraintValidationTest(io.stackgres.operator.validation.ConstraintValidationTest)

Example 3 with StackGresDbOpsReview

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

the class DbOpsPgbenchConstraintValidatorTest method nullBenchmarkPgbench_shouldFail.

@Test
void nullBenchmarkPgbench_shouldFail() {
    StackGresDbOpsReview review = getValidReview();
    review.getRequest().getObject().getSpec().getBenchmark().setPgbench(null);
    checkErrorCause(StackGresDbOpsBenchmark.class, "spec.benchmark.pgbench", "spec.benchmark.isPgbenchSectionProvided", review, AssertTrue.class);
}
Also used : StackGresDbOpsReview(io.stackgres.operator.common.StackGresDbOpsReview) Test(org.junit.jupiter.api.Test) ConstraintValidationTest(io.stackgres.operator.validation.ConstraintValidationTest)

Example 4 with StackGresDbOpsReview

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

the class DbOpsPgbenchConstraintValidatorTest method wrongDuration_shouldFail.

@Test
void wrongDuration_shouldFail() {
    StackGresDbOpsReview review = getValidReview();
    review.getRequest().getObject().getSpec().getBenchmark().getPgbench().setDuration("10s");
    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)

Example 5 with StackGresDbOpsReview

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

the class DbOpsPgbenchConstraintValidatorTest method getInvalidReview.

@Override
protected StackGresDbOpsReview getInvalidReview() {
    final StackGresDbOpsReview review = JsonUtil.readFromJson("dbops_allow_requests/valid_pgbench_creation.json", StackGresDbOpsReview.class);
    review.getRequest().getObject().setSpec(null);
    return review;
}
Also used : StackGresDbOpsReview(io.stackgres.operator.common.StackGresDbOpsReview)

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