use of io.stackgres.operator.common.StackGresClusterReview in project stackgres by ongres.
the class ClusterConstraintValidatorTest method invalidTolerationOperator_shouldFail.
@Test
void invalidTolerationOperator_shouldFail() {
StackGresClusterReview review = getValidReview();
review.getRequest().getObject().getSpec().getPod().setScheduling(new StackGresClusterPodScheduling());
review.getRequest().getObject().getSpec().getPod().getScheduling().setTolerations(new ArrayList<>());
review.getRequest().getObject().getSpec().getPod().getScheduling().getTolerations().add(new Toleration());
review.getRequest().getObject().getSpec().getPod().getScheduling().getTolerations().get(0).setKey("test");
review.getRequest().getObject().getSpec().getPod().getScheduling().getTolerations().get(0).setOperator("NotExists");
checkErrorCause(Toleration.class, "spec.pod.scheduling.tolerations[0].operator", "isOperatorValid", review, AssertTrue.class);
}
use of io.stackgres.operator.common.StackGresClusterReview in project stackgres by ongres.
the class ClusterConstraintValidatorTest method validTolerationKeyEmpty_shouldPass.
@Test
void validTolerationKeyEmpty_shouldPass() throws ValidationFailed {
StackGresClusterReview review = getValidReview();
review.getRequest().getObject().getSpec().getPod().setScheduling(new StackGresClusterPodScheduling());
review.getRequest().getObject().getSpec().getPod().getScheduling().setTolerations(new ArrayList<>());
review.getRequest().getObject().getSpec().getPod().getScheduling().getTolerations().add(new Toleration());
review.getRequest().getObject().getSpec().getPod().getScheduling().getTolerations().get(0).setKey("");
review.getRequest().getObject().getSpec().getPod().getScheduling().getTolerations().get(0).setOperator("Exists");
validator.validate(review);
}
use of io.stackgres.operator.common.StackGresClusterReview in project stackgres by ongres.
the class ClusterConstraintValidatorTest method nullVolumeSize_shouldFail.
@Test
void nullVolumeSize_shouldFail() {
StackGresClusterReview review = getValidReview();
review.getRequest().getObject().getSpec().getPod().getPersistentVolume().setSize(null);
checkNotNullErrorCause(StackGresPodPersistentVolume.class, "spec.pod.persistentVolume.size", review);
}
use of io.stackgres.operator.common.StackGresClusterReview in project stackgres by ongres.
the class ClusterConstraintValidatorTest method invalidVolumeSize_shouldFail.
@Test
void invalidVolumeSize_shouldFail() {
StackGresClusterReview review = getValidReview();
review.getRequest().getObject().getSpec().getPod().getPersistentVolume().setSize("512");
checkErrorCause(StackGresPodPersistentVolume.class, "spec.pod.persistentVolume.size", review, Pattern.class);
}
use of io.stackgres.operator.common.StackGresClusterReview in project stackgres by ongres.
the class ClusterConstraintValidatorTest method missingScriptFrom_shouldFail.
@Test
void missingScriptFrom_shouldFail() {
StackGresClusterReview review = getValidReview();
review.getRequest().getObject().getSpec().setInitData(new StackGresClusterInitData());
review.getRequest().getObject().getSpec().getInitData().setScripts(new ArrayList<>());
review.getRequest().getObject().getSpec().getInitData().getScripts().add(new StackGresClusterScriptEntry());
review.getRequest().getObject().getSpec().getInitData().getScripts().get(0).setScriptFrom(new StackGresClusterScriptFrom());
checkErrorCause(StackGresClusterScriptFrom.class, new String[] { "spec.initData.scripts[0].scriptFrom.secretKeyRef", "spec.initData.scripts[0].scriptFrom.configMapKeyRef" }, "isSecretKeySelectorAndConfigMapKeySelectorMutuallyExclusiveAndRequired", review, AssertTrue.class);
}
Aggregations