Search in sources :

Example 6 with DryRun

use of org.apache.whirr.service.DryRunModule.DryRun in project whirr by apache.

the class BaseServiceDryRunTest method launchWithClusterSpec.

protected DryRun launchWithClusterSpec(ClusterSpec clusterSpec) throws IOException, InterruptedException {
    ClusterController controller = new ClusterController();
    DryRun dryRun = controller.getCompute().apply(clusterSpec).utils().injector().getInstance(DryRun.class);
    dryRun.reset();
    controller.launchCluster(clusterSpec);
    return dryRun;
}
Also used : ClusterController(org.apache.whirr.ClusterController) DryRun(org.apache.whirr.service.DryRunModule.DryRun)

Example 7 with DryRun

use of org.apache.whirr.service.DryRunModule.DryRun in project whirr by apache.

the class ChefServiceDryRunTest method testChefWithAttributes.

/**
 * Tests that a simple recipe (the default recipe in a cookbook without any
 * configuration parameters) is correctly loaded and executed.
 */
@Test
public void testChefWithAttributes() throws Exception {
    ClusterSpec cookbookWithSpecificRecipe = newClusterSpecForProperties(ImmutableMap.of("whirr.instance-templates", "1 chef:java:sun"));
    DryRun dryRun = launchWithClusterSpec(cookbookWithSpecificRecipe);
    assertScriptPredicateOnPhase(dryRun, "bootstrap", bootstrapPredicate());
    // chef execution with a default cookbook recipe should contain a
    // particular string
    assertScriptPredicateOnPhase(dryRun, "configure", containsPattern("chef-solo -j /tmp/java::sun"));
}
Also used : DryRun(org.apache.whirr.service.DryRunModule.DryRun) ClusterSpec(org.apache.whirr.ClusterSpec) Test(org.junit.Test) BaseServiceDryRunTest(org.apache.whirr.service.BaseServiceDryRunTest)

Example 8 with DryRun

use of org.apache.whirr.service.DryRunModule.DryRun in project whirr by apache.

the class ChefServiceDryRunTest method testChefOnly.

/**
 * Tests that a simple recipe (the default recipe in a cookbook without any
 * 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.
}
Also used : DryRun(org.apache.whirr.service.DryRunModule.DryRun) ClusterSpec(org.apache.whirr.ClusterSpec) Test(org.junit.Test) BaseServiceDryRunTest(org.apache.whirr.service.BaseServiceDryRunTest)

Example 9 with DryRun

use of org.apache.whirr.service.DryRunModule.DryRun in project whirr by apache.

the class KerberosServerDryRunTest method testJavaInstalled.

@Test
public void testJavaInstalled() throws Exception {
    DryRun dryRun = launchWithClusterSpec(newClusterSpecForProperties(ImmutableMap.of("whirr.instance-templates", "1 " + KerberosServerHandler.ROLE + "+" + KerberosClientHandler.ROLE)));
    assertScriptPredicateOnPhase(dryRun, "bootstrap", bootstrapPredicate());
    assertScriptPredicateOnPhase(dryRun, "bootstrap", containsPattern("install_openjdk"));
}
Also used : DryRun(org.apache.whirr.service.DryRunModule.DryRun) BaseServiceDryRunTest(org.apache.whirr.service.BaseServiceDryRunTest) Test(org.junit.Test)

Example 10 with DryRun

use of org.apache.whirr.service.DryRunModule.DryRun in project whirr by apache.

the class KerberosServerDryRunTest method testKerberosRealm.

@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());
}
Also used : DryRun(org.apache.whirr.service.DryRunModule.DryRun) BaseServiceDryRunTest(org.apache.whirr.service.BaseServiceDryRunTest) Test(org.junit.Test)

Aggregations

DryRun (org.apache.whirr.service.DryRunModule.DryRun)20 Test (org.junit.Test)19 ClusterSpec (org.apache.whirr.ClusterSpec)9 BaseServiceDryRunTest (org.apache.whirr.service.BaseServiceDryRunTest)9 StatementOnNode (org.jclouds.compute.events.StatementOnNode)7 ClusterController (org.apache.whirr.ClusterController)5 Collection (java.util.Collection)3 CompositeConfiguration (org.apache.commons.configuration.CompositeConfiguration)3 NodeMetadata (org.jclouds.compute.domain.NodeMetadata)3 Statement (org.jclouds.scriptbuilder.domain.Statement)3 Stack (java.util.Stack)1 AssertionFailedError (junit.framework.AssertionFailedError)1 Cluster (org.apache.whirr.Cluster)1