@Override public void onSuccess(final JobDeployResponse result) { assertEquals(JobDeployResponse.Status.OK, result.getStatus()); }
private void deploy(final String token, final JobDeployResponse.Status status) throws Exception { final List<String> args = buildArgs(token, testJobNameAndVersion, testHost()); final JobDeployResponse response = cliJson(JobDeployResponse.class, "deploy", args); assertThat(response.getStatus(), equalTo(status)); }
private JobId createAndAwaitJobRunning() throws Exception { final CreateJobResponse jobby = client.createJob(job).get(); assertEquals(CreateJobResponse.Status.OK, jobby.getStatus()); final JobId jobId = job.getId(); final JobDeployResponse deployResponse = client.deploy( Deployment.of(jobId, START), TEST_HOST).get(); assertEquals(JobDeployResponse.Status.OK, deployResponse.getStatus()); awaitJobState(client, TEST_HOST, jobId, State.RUNNING, 30, TimeUnit.SECONDS); return jobId; }
private void deploy(final Job job) throws Exception { final JobId jobId = job.getId(); final CreateJobResponse created = client.createJob(job).get(); assertEquals(CreateJobResponse.Status.OK, created.getStatus()); final Deployment deployment = Deployment.of(jobId, START); final JobDeployResponse deployed = client.deploy(deployment, testHost()).get(); assertEquals(JobDeployResponse.Status.OK, deployed.getStatus()); // Wait for the job to run awaitJobState(client, testHost(), jobId, RUNNING, LONG_WAIT_SECONDS, SECONDS); }
if (result.getStatus() == JobDeployResponse.Status.OK) { if (!json) { out.printf("done%n");
@Test public void testDeployingNonexistantJobJson() throws Exception { startDefaultMaster(); // Wait for master to come up Polling.await(LONG_WAIT_SECONDS, SECONDS, new Callable<String>() { @Override public String call() throws Exception { final String output = cli("masters"); return output.contains(masterName()) ? output : null; } }); // Verify that deploying a nonexistent job to the host fails final String output = cli("deploy", "--json", BOGUS_JOB.toString(), testHost()); final JobDeployResponse jobDeployResponse = Json.read(output, JobDeployResponse.class); assertEquals(JobDeployResponse.Status.JOB_NOT_FOUND, jobDeployResponse.getStatus()); }
@Test public void testUndeployingNonexistantJobJson() throws Exception { startDefaultMaster(); // Wait for master to come up Polling.await(LONG_WAIT_SECONDS, SECONDS, new Callable<String>() { @Override public String call() throws Exception { final String output = cli("masters"); return output.contains(masterName()) ? output : null; } }); // Verify that undeploying a nonexistent job from a host fails final String output = cli("undeploy", "--json", BOGUS_JOB.toString(), testHost()); final JobDeployResponse jobDeployResponse = Json.read(output, JobDeployResponse.class); assertEquals(JobDeployResponse.Status.JOB_NOT_FOUND, jobDeployResponse.getStatus()); }
@Test public void testDeployingNonexistantHostJson() throws Exception { startDefaultMaster(); // Wait for master to come up Polling.await(LONG_WAIT_SECONDS, SECONDS, new Callable<String>() { @Override public String call() throws Exception { final String output = cli("masters"); return output.contains(masterName()) ? output : null; } }); // Create job final JobId jobId = createJob(testJobName, testJobVersion, BUSYBOX, IDLE_COMMAND); // Verify that deploying a job to a nonexistent host fails final String output = cli("deploy", "--json", jobId.toString(), BOGUS_HOST); final JobDeployResponse jobDeployResponse = Json.read(output, JobDeployResponse.class); assertEquals(JobDeployResponse.Status.HOST_NOT_FOUND, jobDeployResponse.getStatus()); }
@Test public void testUndeployingNonexistantHostJson() throws Exception { startDefaultMaster(); // Wait for master to come up Polling.await(LONG_WAIT_SECONDS, SECONDS, new Callable<String>() { @Override public String call() throws Exception { final String output = cli("masters"); return output.contains(masterName()) ? output : null; } }); // Create job final JobId jobId = createJob(testJobName, testJobVersion, BUSYBOX, IDLE_COMMAND); // Verify that undeploying a nonexistent job from a host fails final String output = cli("undeploy", "--json", jobId.toString(), BOGUS_HOST); final JobDeployResponse jobDeployResponse = Json.read(output, JobDeployResponse.class); assertEquals(JobDeployResponse.Status.HOST_NOT_FOUND, jobDeployResponse.getStatus()); } }
public void assertRamdisk(final JobId jobId) throws Exception { // Wait for agent to come up awaitHostRegistered(client, testHost(), LONG_WAIT_SECONDS, SECONDS); awaitHostStatus(client, testHost(), UP, LONG_WAIT_SECONDS, SECONDS); // Deploy the job on the agent final Deployment deployment = Deployment.of(jobId, START); final JobDeployResponse deployed = client.deploy(deployment, testHost()).get(); assertEquals(JobDeployResponse.Status.OK, deployed.getStatus()); // Wait for the job to run final TaskStatus taskStatus = awaitJobState( client, testHost(), jobId, RUNNING, LONG_WAIT_SECONDS, SECONDS); assertJobEquals(job, taskStatus.getJob()); final Integer dfPort = taskStatus.getPorts().get("df").getExternalPort(); assert dfPort != null; // If "/much-volatile" mount is present a line starting with tmpfs should be returned final String dfOutput = recvUtf8(dfPort, 5); assertEquals("tmpfs", dfOutput); }
public void assertVolumes(final JobId jobId) throws Exception { // Wait for agent to come up awaitHostRegistered(client, testHost(), LONG_WAIT_SECONDS, SECONDS); awaitHostStatus(client, testHost(), UP, LONG_WAIT_SECONDS, SECONDS); // Deploy the job on the agent final Deployment deployment = Deployment.of(jobId, START); final JobDeployResponse deployed = client.deploy(deployment, testHost()).get(); assertEquals(JobDeployResponse.Status.OK, deployed.getStatus()); // Wait for the job to run final TaskStatus taskStatus = awaitJobState( client, testHost(), jobId, RUNNING, LONG_WAIT_SECONDS, SECONDS); assertJobEquals(job, taskStatus.getJob()); final Integer randomVolPort = taskStatus.getPorts().get("random").getExternalPort(); final Integer namedVolPort = taskStatus.getPorts().get("named").getExternalPort(); final Integer hostnamePort = taskStatus.getPorts().get("hostname").getExternalPort(); assert randomVolPort != null; assert namedVolPort != null; assert hostnamePort != null; // Read "foo" from /volume/bar and /mnt/my-volume/bar assertEquals("foo", recvUtf8(randomVolPort, 3)); assertEquals("foo", recvUtf8(namedVolPort, 3)); // Read hostname from /hostname final String hostname = getNewDockerClient().info().name(); final String mountedHostname = recvUtf8(hostnamePort, hostname.length()); assertEquals(hostname, mountedHostname); }
assertEquals(JobDeployResponse.Status.OK, deployed.getStatus());
assertEquals(JobDeployResponse.Status.OK, deployed.getStatus());
assertEquals(JobDeployResponse.Status.OK, deployed.getStatus());
@Test public void test() throws Exception { final CreateJobResponse created = client.createJob(job).get(); assertEquals(CreateJobResponse.Status.OK, created.getStatus()); final JobId jobId = job.getId(); // Wait for agent to come up awaitHostRegistered(client, testHost(), LONG_WAIT_SECONDS, SECONDS); awaitHostStatus(client, testHost(), UP, LONG_WAIT_SECONDS, SECONDS); // Deploy the job on the agent final Deployment deployment = Deployment.of(jobId, START); final JobDeployResponse deployed = client.deploy(deployment, testHost()).get(); assertEquals(JobDeployResponse.Status.OK, deployed.getStatus()); // Wait for the job to run final TaskStatus taskStatus = awaitJobState( client, testHost(), jobId, RUNNING, LONG_WAIT_SECONDS, SECONDS); try (final DockerClient docker = getNewDockerClient()) { final HostConfig hostConfig = docker.inspectContainer(taskStatus.getContainerId()).hostConfig(); assertEquals(NETWORK_MODE, hostConfig.networkMode()); } } }
assertEquals(JobDeployResponse.Status.OK, deployed.getStatus());
assertEquals(JobDeployResponse.Status.OK, deployed.getStatus());
assertEquals(JobDeployResponse.Status.OK, deployed.getStatus());
assertEquals(JobDeployResponse.Status.OK, deployed.getStatus());