use of com.netflix.titus.common.model.sanitizer.ValidationError in project titus-control-plane by Netflix.
the class AggregatingValidatorTest method validateHardFailFail.
@Test
public void validateHardFailFail() {
AdmissionValidator fail0 = new FailJobValidator(ValidationError.Type.HARD);
AdmissionValidator fail1 = new FailJobValidator(ValidationError.Type.HARD);
AggregatingValidator validator = new AggregatingValidator(configuration, registry, Arrays.asList(fail0, fail1));
Mono<Set<ValidationError>> mono = validator.validate(MOCK_JOB);
StepVerifier.create(mono).expectNextMatches(errors -> errors.size() == 2).verifyComplete();
Set<ValidationError> errors = mono.block();
validateFailErrors(errors);
validateErrorType(errors, ValidationError.Type.HARD);
}
use of com.netflix.titus.common.model.sanitizer.ValidationError in project titus-control-plane by Netflix.
the class AggregatingValidatorTest method validateHardSoftPass.
@Test
public void validateHardSoftPass() {
AdmissionValidator pass0 = new PassJobValidator();
AdmissionValidator pass1 = new PassJobValidator();
AdmissionValidator validator = new AggregatingValidator(configuration, registry, Arrays.asList(pass0, pass1));
Mono<Set<ValidationError>> mono = validator.validate(MOCK_JOB);
StepVerifier.create(mono).expectNextMatches(errors -> errors.size() == 0).verifyComplete();
}
use of com.netflix.titus.common.model.sanitizer.ValidationError in project titus-control-plane by Netflix.
the class AggregatingValidatorTest method validateHardPassFail.
@Test
public void validateHardPassFail() {
AdmissionValidator pass = new PassJobValidator();
AdmissionValidator fail = new FailJobValidator(ValidationError.Type.HARD);
AggregatingValidator validator = new AggregatingValidator(configuration, registry, Arrays.asList(pass, fail));
Mono<Set<ValidationError>> mono = validator.validate(MOCK_JOB);
StepVerifier.create(mono).expectNextMatches(errors -> errors.size() == 1).verifyComplete();
Set<ValidationError> errors = mono.block();
validateFailErrors(errors);
validateErrorType(errors, ValidationError.Type.HARD);
}
use of com.netflix.titus.common.model.sanitizer.ValidationError in project titus-control-plane by Netflix.
the class AggregatingValidatorTest method validateSoftFailure.
@Test
public void validateSoftFailure() {
AdmissionValidator fail = new FailJobValidator(ValidationError.Type.HARD);
AdmissionValidator validator = new AggregatingValidator(configuration, registry, Arrays.asList(fail));
Mono<Set<ValidationError>> mono = validator.validate(MOCK_JOB);
StepVerifier.create(mono).expectNextMatches(errors -> errors.size() == 1).verifyComplete();
Collection<ValidationError> errors = mono.block();
validateFailErrors(errors);
validateErrorType(errors, ValidationError.Type.HARD);
}
use of com.netflix.titus.common.model.sanitizer.ValidationError in project titus-control-plane by Netflix.
the class AggregatingValidatorTest method validateHardSoftFail.
@Test
public void validateHardSoftFail() {
AdmissionValidator fail0 = new FailJobValidator(ValidationError.Type.HARD);
AdmissionValidator fail1 = new FailJobValidator(ValidationError.Type.HARD);
AdmissionValidator validator = new AggregatingValidator(configuration, registry, Arrays.asList(fail0, fail1));
Mono<Set<ValidationError>> mono = validator.validate(MOCK_JOB);
StepVerifier.create(mono).expectNextMatches(errors -> errors.size() == 2).verifyComplete();
Collection<ValidationError> errors = mono.block();
validateFailErrors(errors);
assertThat(errors).allMatch(error -> error.getType().equals(ValidationError.Type.HARD));
}
Aggregations