use of com.mesosphere.sdk.specification.ServiceSpec in project dcos-commons by mesosphere.
the class PreReservationCannotChangeTest method testSecondPodRemovalPassesValidation.
@Test
public void testSecondPodRemovalPassesValidation() {
Optional<ServiceSpec> serviceSpec1 = Optional.of(DefaultServiceSpec.newBuilder().name("svc1").role(TestConstants.ROLE).principal(TestConstants.PRINCIPAL).pods(Arrays.asList(mockPodSpec1, mockPodSpec2)).build());
ServiceSpec serviceSpec2 = DefaultServiceSpec.newBuilder().name("svc2").role(TestConstants.ROLE).principal(TestConstants.PRINCIPAL).pods(Arrays.asList(mockPodSpec1)).build();
assertThat(VALIDATOR.validate(serviceSpec1, serviceSpec2), is(empty()));
}
use of com.mesosphere.sdk.specification.ServiceSpec in project dcos-commons by mesosphere.
the class PreReservationCannotChangeTest method testReplacedPodPassesValidation.
@Test
public void testReplacedPodPassesValidation() {
Optional<ServiceSpec> serviceSpec1 = Optional.of(DefaultServiceSpec.newBuilder().name("svc1").role(TestConstants.ROLE).principal(TestConstants.PRINCIPAL).pods(Arrays.asList(mockPodSpec1)).build());
final ServiceSpec serviceSpec2 = DefaultServiceSpec.newBuilder().name("svc1").role(TestConstants.ROLE).principal(TestConstants.PRINCIPAL).pods(Arrays.asList(mockPodSpec1)).build();
assertThat(VALIDATOR.validate(serviceSpec1, serviceSpec2), is(empty()));
}
use of com.mesosphere.sdk.specification.ServiceSpec in project dcos-commons by mesosphere.
the class PreReservationCannotChangeTest method testMissingPreReservedRolesPassesValidation.
@Test
public void testMissingPreReservedRolesPassesValidation() {
Optional<ServiceSpec> serviceSpec1 = Optional.of(DefaultServiceSpec.newBuilder().name("svc1").role(TestConstants.ROLE).principal(TestConstants.PRINCIPAL).pods(Arrays.asList(mockPodSpec1WithNoRole)).build());
ServiceSpec serviceSpec2 = DefaultServiceSpec.newBuilder().name("svc2").role(TestConstants.ROLE).principal(TestConstants.PRINCIPAL).pods(Arrays.asList(mockPodSpec1WithNoRole)).build();
assertThat(VALIDATOR.validate(serviceSpec1, serviceSpec2), is(empty()));
}
use of com.mesosphere.sdk.specification.ServiceSpec in project dcos-commons by mesosphere.
the class PreReservationCannotChangeTest method testRemovalOfPreReservedRoleFailsValidation.
@Test
public void testRemovalOfPreReservedRoleFailsValidation() {
Optional<ServiceSpec> serviceSpec1 = Optional.of(DefaultServiceSpec.newBuilder().name("svc1").role(TestConstants.ROLE).principal(TestConstants.PRINCIPAL).pods(Arrays.asList(mockPodSpec1)).build());
ServiceSpec serviceSpec2 = DefaultServiceSpec.newBuilder().name("svc2").role(TestConstants.ROLE).principal(TestConstants.PRINCIPAL).pods(Arrays.asList(mockPodSpec1WithNoRole)).build();
assertThat(VALIDATOR.validate(serviceSpec1, serviceSpec2), hasSize(1));
}
use of com.mesosphere.sdk.specification.ServiceSpec in project dcos-commons by mesosphere.
the class PreReservationCannotChangeTest method testAdditionOfPreReservedRoleFailsValidation.
@Test
public void testAdditionOfPreReservedRoleFailsValidation() {
Optional<ServiceSpec> serviceSpec1 = Optional.of(DefaultServiceSpec.newBuilder().name("svc1").role(TestConstants.ROLE).principal(TestConstants.PRINCIPAL).pods(Arrays.asList(mockPodSpec1WithNoRole)).build());
ServiceSpec serviceSpec2 = DefaultServiceSpec.newBuilder().name("svc2").role(TestConstants.ROLE).principal(TestConstants.PRINCIPAL).pods(Arrays.asList(mockPodSpec1)).build();
assertThat(VALIDATOR.validate(serviceSpec1, serviceSpec2), hasSize(1));
}
Aggregations