use of com.hubspot.singularity.SingularityRequest in project Singularity by HubSpot.
the class ValidatorTest method whenDeployNotOneOffOrScheduledItForbidsRunImmediately.
@Test(expected = WebApplicationException.class)
public void whenDeployNotOneOffOrScheduledItForbidsRunImmediately() {
String requestId = "request";
String deployID = "deploy";
SingularityRequest request = new SingularityRequestBuilder(requestId, RequestType.WORKER).build();
Optional<SingularityRunNowRequest> runNowRequest = Optional.of(runNowRequest());
SingularityDeploy deploy = SingularityDeploy.newBuilder(requestId, deployID).setCommand(Optional.of("printenv")).setRunImmediately(runNowRequest).build();
validator.checkDeploy(request, deploy, Collections.emptyList(), Collections.emptyList());
}
use of com.hubspot.singularity.SingularityRequest in project Singularity by HubSpot.
the class ValidatorTest method itForbidsBracketCharactersInDeployIds.
@Test(expected = WebApplicationException.class)
public void itForbidsBracketCharactersInDeployIds() throws Exception {
final String badDeployId = "deployKey[[";
SingularityDeploy singularityDeploy = SingularityDeploy.newBuilder(badDeployId, badDeployId).build();
SingularityRequest singularityRequest = new SingularityRequestBuilder(badDeployId, RequestType.SERVICE).build();
validator.checkDeploy(singularityRequest, singularityDeploy, Collections.emptyList(), Collections.emptyList());
}
use of com.hubspot.singularity.SingularityRequest in project Singularity by HubSpot.
the class ValidatorTest method itForbidsTooLongDeployId.
@Test(expected = WebApplicationException.class)
public void itForbidsTooLongDeployId() {
String requestId = "requestId";
SingularityRequest request = new SingularityRequestBuilder(requestId, RequestType.SCHEDULED).build();
SingularityDeploy deploy = SingularityDeploy.newBuilder(requestId, tooLongId()).build();
validator.checkDeploy(request, deploy, Collections.emptyList(), Collections.emptyList());
}
use of com.hubspot.singularity.SingularityRequest in project Singularity by HubSpot.
the class ValidatorTest method itAllowsWorkerToServiceTransitionIfNotLoadBalanced.
@Test
public void itAllowsWorkerToServiceTransitionIfNotLoadBalanced() {
SingularityRequest request = new SingularityRequestBuilder("test", RequestType.WORKER).build();
SingularityRequest newRequest = new SingularityRequestBuilder("test", RequestType.SERVICE).build();
SingularityRequest result = validator.checkSingularityRequest(newRequest, Optional.of(request), Optional.absent(), Optional.absent());
Assert.assertEquals(newRequest.getRequestType(), result.getRequestType());
}
use of com.hubspot.singularity.SingularityRequest in project Singularity by HubSpot.
the class ValidatorTest method whenRunNowItForbidsRequestsForLongRunningTasks.
@Test(expected = WebApplicationException.class)
public void whenRunNowItForbidsRequestsForLongRunningTasks() {
String deployID = "deploy";
Optional<String> userEmail = Optional.absent();
SingularityRequest request = new SingularityRequestBuilder("request2", RequestType.SERVICE).build();
Optional<SingularityRunNowRequest> runNowRequest = Optional.absent();
List<SingularityTaskId> activeTasks = Collections.emptyList();
List<SingularityPendingTaskId> pendingTasks = Collections.emptyList();
validator.checkRunNowRequest(deployID, userEmail, request, runNowRequest, activeTasks, pendingTasks);
}
Aggregations