Search in sources :

Example 1 with MasterMain

use of com.spotify.helios.master.MasterMain in project helios by spotify.

the class SystemTestBase method startMaster.

protected MasterMain startMaster(final String... args) throws Exception {
    final MasterMain main = new MasterMain(args);
    main.startAsync().awaitRunning();
    services.add(main);
    return main;
}
Also used : MasterMain(com.spotify.helios.master.MasterMain)

Example 2 with MasterMain

use of com.spotify.helios.master.MasterMain in project helios by spotify.

the class SystemTestBase method startDefaultMaster.

protected MasterMain startDefaultMaster(final int offset, final String... args) throws Exception {
    final List<String> argsList = setupDefaultMaster(offset, args);
    if (argsList == null) {
        return null;
    }
    final MasterMain master = startMaster(argsList.toArray(new String[argsList.size()]));
    waitForMasterToBeFullyUp();
    return master;
}
Also used : MasterMain(com.spotify.helios.master.MasterMain) Matchers.containsString(org.hamcrest.Matchers.containsString) Integer.toHexString(java.lang.Integer.toHexString)

Example 3 with MasterMain

use of com.spotify.helios.master.MasterMain in project helios by spotify.

the class SystemTestBase method startMaster.

MasterMain startMaster(final CuratorClientFactory curatorClientFactory, final String... args) throws Exception {
    final MasterMain main = new MasterMain(curatorClientFactory, args);
    main.startAsync().awaitRunning();
    services.add(main);
    return main;
}
Also used : MasterMain(com.spotify.helios.master.MasterMain)

Example 4 with MasterMain

use of com.spotify.helios.master.MasterMain in project helios by spotify.

the class SystemTestBase method startDefaultMasters.

protected Map<String, MasterMain> startDefaultMasters(final int numMasters, String... args) throws Exception {
    final Map<String, MasterMain> masters = Maps.newHashMap();
    for (int i = 0; i < numMasters; i++) {
        final String name = TEST_MASTER + i;
        final List<String> argsList = Lists.newArrayList(args);
        argsList.addAll(asList("--name", name));
        masters.put(name, startDefaultMaster(i, argsList.toArray(new String[argsList.size()])));
    }
    return masters;
}
Also used : MasterMain(com.spotify.helios.master.MasterMain) Matchers.containsString(org.hamcrest.Matchers.containsString) Integer.toHexString(java.lang.Integer.toHexString) ServiceEndpoint(com.spotify.helios.common.descriptors.ServiceEndpoint)

Example 5 with MasterMain

use of com.spotify.helios.master.MasterMain in project helios by spotify.

the class DeploymentGroupTest method testRollingUpdateCoordination.

@Test
public void testRollingUpdateCoordination() throws Exception {
    // stop the default master
    master.stopAsync().awaitTerminated();
    // start a bunch of masters and agents
    final Map<String, MasterMain> masters = startDefaultMasters(3);
    final Map<String, AgentMain> agents = Maps.newLinkedHashMap();
    for (int i = 0; i < 20; i++) {
        final String name = TEST_HOST + i;
        agents.put(name, startDefaultAgent(name, "--labels", TEST_LABEL));
    }
    // create a deployment group and start rolling out
    cli("create-deployment-group", "--json", TEST_GROUP, TEST_LABEL);
    final JobId jobId = createJob(testJobName, testJobVersion, BUSYBOX, IDLE_COMMAND);
    cli("rolling-update", "--async", "--par", String.valueOf(agents.size()), testJobNameAndVersion, TEST_GROUP);
    // wait until the task is running on the final agent
    awaitTaskState(jobId, getLast(agents.keySet()), TaskStatus.State.RUNNING);
    // ensure that all masters were involved
    final Set<String> deployingMasters = Sets.newHashSet();
    final Map<String, HostStatus> hostStatuses = defaultClient().hostStatuses(Lists.newArrayList(agents.keySet())).get();
    for (final HostStatus status : hostStatuses.values()) {
        for (final Deployment deployment : status.getJobs().values()) {
            deployingMasters.add(deployment.getDeployerMaster());
        }
    }
    assertEquals(masters.size(), deployingMasters.size());
}
Also used : AgentMain(com.spotify.helios.agent.AgentMain) MasterMain(com.spotify.helios.master.MasterMain) Deployment(com.spotify.helios.common.descriptors.Deployment) HostStatus(com.spotify.helios.common.descriptors.HostStatus) Matchers.containsString(org.hamcrest.Matchers.containsString) JobId(com.spotify.helios.common.descriptors.JobId) Test(org.junit.Test)

Aggregations

MasterMain (com.spotify.helios.master.MasterMain)5 Matchers.containsString (org.hamcrest.Matchers.containsString)3 Integer.toHexString (java.lang.Integer.toHexString)2 AgentMain (com.spotify.helios.agent.AgentMain)1 Deployment (com.spotify.helios.common.descriptors.Deployment)1 HostStatus (com.spotify.helios.common.descriptors.HostStatus)1 JobId (com.spotify.helios.common.descriptors.JobId)1 ServiceEndpoint (com.spotify.helios.common.descriptors.ServiceEndpoint)1 Test (org.junit.Test)1