Package com.spotify.helios.common.descriptors

Examples of com.spotify.helios.common.descriptors.JobId


  public void testNoDnsParam() throws Exception {
    startDefaultMaster();
    startDefaultAgent(testHost());
    awaitHostStatus(testHost(), UP, LONG_WAIT_SECONDS, SECONDS);

    final JobId jobId = createJob(testJobName, testJobVersion, BUSYBOX,
                                  asList("cat", "/etc/resolv.conf"));

    deployJob(jobId, testHost());

    final TaskStatus taskStatus = awaitTaskState(jobId, testHost(), EXITED);
View Full Code Here


    awaitHostRegistered(client, TEST_HOST, LONG_WAIT_SECONDS, SECONDS);
  }

  @Test
  public void testMaster() throws Exception {
    final JobId jobId = createAndAwaitJobRunning();

    // shut down the agent so it cannot remove the tombstone we make
    agent.stopAsync().awaitTerminated();

    // make sure things look correct before
View Full Code Here

    assertTrue(zkMasterModel.getHostStatus(TEST_HOST).getJobs().isEmpty());
  }

  @Test
  public void testAgent() throws Exception {
    final JobId jobId = createAndAwaitJobRunning();

    final byte[] data1 = curator.getData().forPath(Paths.statusHostJob(TEST_HOST, jobId));
    assertNotNull(data1);
    final TaskStatus status = Json.read(data1, TaskStatus.class);
    assertNotNull(status);
View Full Code Here

  }

  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;
View Full Code Here

      final ImmutableMap<String, PortMapping> expectedMapping2 =
          ImmutableMap.of("foo", PortMapping.of(4711, portRange.lowerEndpoint() + 1),
                          "bar", PortMapping.of(4712, externalPort2));

      final JobId jobId1 = createJob(testJobName + 1, testJobVersion, BUSYBOX, IDLE_COMMAND,
                                     EMPTY_ENV, ports1);

      assertNotNull(jobId1);
      deployJob(jobId1, testHost());
      final TaskStatus firstTaskStatus1 = awaitJobState(client, testHost(), jobId1, RUNNING,
                                                        LONG_WAIT_SECONDS, SECONDS);

      final JobId jobId2 = createJob(testJobName + 2, testJobVersion, BUSYBOX, IDLE_COMMAND,
                                     EMPTY_ENV, ports2);

      assertNotNull(jobId2);
      deployJob(jobId2, testHost());
      final TaskStatus firstTaskStatus2 = awaitJobState(client, testHost(), jobId2, RUNNING,
View Full Code Here

    final Map<String, PortMapping> ports =
        ImmutableMap.of("bar", PortMapping.of(4712, externalPort1));

    try (final DockerClient dockerClient = getNewDockerClient()) {
      final JobId jobId = createJob(testJobName + 1, testJobVersion, BUSYBOX,
        asList("sh", "-c", "echo $HELIOS_PORT_bar"), EMPTY_ENV, ports);

      deployJob(jobId, testHost());

      final TaskStatus taskStatus = awaitTaskState(jobId, testHost(), EXITED);
View Full Code Here

    startDefaultMaster("--zk-cluster-id=" + zkClusterId);
    startDefaultAgent(testHost(), "--zk-cluster-id=" + zkClusterId);
    awaitHostStatus(testHost(), UP, LONG_WAIT_SECONDS, SECONDS);

    // Create job and deploy it
    final JobId jobId = createJob(testJobName, testJobVersion, BUSYBOX, IDLE_COMMAND);
    deployJob(jobId, testHost());
    final TaskStatus runningStatus = awaitTaskState(jobId, testHost(), RUNNING);
    final String containerId = runningStatus.getContainerId();

    // Delete the config node which contains the cluster ID and all the job definitions
View Full Code Here

        .setImage(BUSYBOX)
        .setCommand(asList("/bin/sh", "-c", "trap handle 2; handle() { echo int; exit 0; }; "
                                            + "while true; do sleep 1; done"))
        .build();

    final JobId jobId = createJob(jobToInterrupt);
    deployJob(jobId, host);
    awaitTaskState(jobId, host, RUNNING);

    client.setGoal(new Deployment(jobId, Goal.STOP, Deployment.EMTPY_DEPLOYER_USER), host);
View Full Code Here

        .setImage(BUSYBOX)
        .setCommand(asList("/bin/sh", "-c", "trap handle 15; handle() { echo term; exit 0; }; "
                                            + "while true; do sleep 1; done"))
        .build();

    final JobId jobId = createJob(jobToInterrupt);
    deployJob(jobId, host);
    awaitTaskState(jobId, host, RUNNING);

    client.setGoal(new Deployment(jobId, Goal.STOP, Deployment.EMTPY_DEPLOYER_USER), host);
View Full Code Here

    startDefaultMaster();
    startDefaultAgent(testHost());
    awaitHostStatus(testHost(), UP, LONG_WAIT_SECONDS, SECONDS);

    // Create job
    final JobId jobId = createJob(testJobName, testJobVersion, BUSYBOX, IDLE_COMMAND);

    // deploy
    deployJob(jobId, testHost());

    final String[] commands = new String[]{"watch", "--exact", "-z", masterEndpoint(),
                                           "--no-log-setup", jobId.toString(), testHost(),
                                           "FAKE_TEST_AGENT"};

    final AtomicBoolean success = new AtomicBoolean(false);
    final List<String> outputLines = Lists.newArrayList();
View Full Code Here

TOP

Related Classes of com.spotify.helios.common.descriptors.JobId

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.