Examples of DryRun


Examples of org.apache.whirr.service.DryRunModule.DryRun

  }

  @Test(expected = IllegalArgumentException.class)
  public void testEmptyInstanceTemplates() throws Exception {
    T action = newClusterActionInstance(EMPTYSET, EMPTYSET);
    DryRun dryRun = getDryRunForAction(action).reset();

    ClusterSpec tempSpec = ClusterSpec.withTemporaryKeys();

    tempSpec.setClusterName("test-cluster-for-script-exection");
    tempSpec.setProvider("stub");
    tempSpec.setIdentity("dummy");
    tempSpec.setStateStore("none");

    ClusterController controller = new ClusterController();
    Cluster tempCluster = controller.launchCluster(tempSpec);

   
    action.execute(tempSpec, tempCluster);
   
    List<StatementOnNode> executions = dryRun.getTotallyOrderedExecutions();
  }
View Full Code Here

Examples of org.apache.whirr.service.DryRunModule.DryRun

  }

  @Test
  public void testActionIsExecutedOnAllRelevantNodes() throws Exception {
    T action = newClusterActionInstance(EMPTYSET, EMPTYSET);
    DryRun dryRun = getDryRunForAction(action).reset();
   
    action.execute(clusterSpec, cluster);
   
    List<StatementOnNode> executions = dryRun.getTotallyOrderedExecutions();

    // only 2 out of 3 because one instance has only noop
    assertThat(executions.size(), is(2));
  }
View Full Code Here

Examples of org.apache.whirr.service.DryRunModule.DryRun

  @Test
  public void testFilterScriptExecutionByRole() throws Exception {
    String instanceId = getInstaceForRole(cluster, "noop2").getId();
    T action = newClusterActionInstance(ImmutableSet.of("noop2"), EMPTYSET);
    DryRun dryRun = getDryRunForAction(action).reset();
   
    action.execute(clusterSpec, cluster);

    List<StatementOnNode> executions = dryRun.getTotallyOrderedExecutions();

    assertThat(executions.size(), is(1));
    assertHasRole(executions.get(0), cluster, "noop2");
    assertEquals(executions.get(0).getNode().getId(), instanceId);
View Full Code Here

Examples of org.apache.whirr.service.DryRunModule.DryRun

  @Test
  public void testFilterScriptExecutionByInstanceId() throws Exception {
    String instanceId = getInstaceForRole(cluster, "noop3").getId();
    T action = newClusterActionInstance(EMPTYSET, newHashSet(instanceId));
    DryRun dryRun = getDryRunForAction(action).reset();

    action.execute(clusterSpec, cluster);

    List<StatementOnNode> executions = dryRun.getTotallyOrderedExecutions();
   
    assertThat(executions.size(), is(1));
    assertHasRole(executions.get(0), cluster, "noop3");
    assertEquals(executions.get(0).getNode().getId(), instanceId);
View Full Code Here

Examples of org.apache.whirr.service.DryRunModule.DryRun

  @Test
  public void testFilterScriptExecutionByRoleAndInstanceId() throws Exception {
    String instanceId = getInstaceForRole(cluster, "noop1").getId();
    T action = newClusterActionInstance(newHashSet("noop1"), newHashSet(instanceId));
    DryRun dryRun = getDryRunForAction(action).reset();

    action.execute(clusterSpec, cluster);

    List<StatementOnNode> executions = dryRun.getTotallyOrderedExecutions();
   
    assertThat(executions.size(), is(1));
    assertHasRole(executions.get(0), cluster, "noop1");
    assertEquals(executions.get(0).getNode().getId(), instanceId);
View Full Code Here

Examples of org.apache.whirr.service.DryRunModule.DryRun

  }

  @Test
  public void testNoScriptExecutionsForNoop() throws Exception {
    T action = newClusterActionInstance(ImmutableSet.of("noop"), EMPTYSET);
    DryRun dryRun = getDryRunForAction(action).reset();
   
    action.execute(clusterSpec, cluster);

    List<StatementOnNode> executions = dryRun.getTotallyOrderedExecutions();
   
    // empty because noop does not emit any statements
    assertThat(executions.size(), is(0));
  }
View Full Code Here

Examples of org.apache.whirr.service.DryRunModule.DryRun

    return containsPattern("configure_kerberos_client");
  }

  @Test
  public void testNoServer() throws Exception {
    DryRun dryRun = launchWithClusterSpec(newClusterSpecForProperties(ImmutableMap.of("whirr.instance-templates", "1 "
      + KerberosClientHandler.ROLE)));
    assertScriptPredicateOnPhase(dryRun, "bootstrap", bootstrapPredicate());
  }
View Full Code Here

Examples of org.apache.whirr.service.DryRunModule.DryRun

    return containsPattern("configure_kerberos_server");
  }

  @Test
  public void testKerberosRealm() throws Exception {
    DryRun dryRun = launchWithClusterSpec(newClusterSpecForProperties(ImmutableMap.of("whirr.instance-templates", "1 "
      + KerberosServerHandler.ROLE)));
    assertScriptPredicateOnPhase(dryRun, "bootstrap", bootstrapPredicate());
    assertScriptPredicateOnPhase(dryRun, "configure", configurePredicate());
  }
View Full Code Here

Examples of org.apache.whirr.service.DryRunModule.DryRun

   * configuration parameters) is correctly loaded and executed.
   */
  @Test
  public void testChefOnly() throws Exception {
    ClusterSpec chefOnly = newClusterSpecForProperties(ImmutableMap.of("whirr.instance-templates", "1 chef"));
    DryRun dryRun = launchWithClusterSpec(chefOnly);
    assertScriptPredicateOnPhase(dryRun, "bootstrap", bootstrapPredicate());
    // We now have iptables calls by default in the configure phase.
  }
View Full Code Here

Examples of org.apache.whirr.service.DryRunModule.DryRun

   */
  @Test
  public void testChefWithDefaultRecipe() throws Exception {
    ClusterSpec cookbookWithDefaultRecipe = newClusterSpecForProperties(ImmutableMap.of("whirr.instance-templates",
        "1 chef:java"));
    DryRun dryRun = launchWithClusterSpec(cookbookWithDefaultRecipe);

    assertScriptPredicateOnPhase(dryRun, "bootstrap", bootstrapPredicate());

    // chef execution with a default cookbook recipe should contain a
    // particular string
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.