Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/476#discussion_r23760234
  
    --- Diff: 
core/src/test/java/brooklyn/location/basic/SshMachineLocationIntegrationTest.java
 ---
    @@ -75,7 +81,36 @@ public void testExtractingConnectablePassphraselessKey() 
throws Exception {
             ByteArrayOutputStream out = new ByteArrayOutputStream();
             int result = tool.execCommands(MutableMap.<String,Object>of("out", 
out), Arrays.asList("date"));
             Assert.assertTrue(out.toString().contains(" 20"), "out="+out);
    -        Assert.assertEquals(result, 0);
    +        assertEquals(result, 0);
    +    }
    +
    +    @Test(groups = "Integration")
    +    public void testExecScriptScriptDirFlagIsRespected() throws Exception {
    +        // For explanation of (some of) the magic behind this command, see 
http://stackoverflow.com/a/229606/68898
    +        final String command = "if [[ \"$0\" == \"/var/tmp/\"* ]]; then 
true; else false; fi";
    +
    +        LocalhostMachineProvisioningLocation lhp = 
(LocalhostMachineProvisioningLocation) 
mgmt.getLocationRegistry().resolve("localhost", true, null).orNull();
    +        SshMachineLocation sm = lhp.obtain();
    +
    +        Map<String, Object> props = ImmutableMap.<String, Object>builder()
    +                .put(SshTool.PROP_SCRIPT_DIR.getName(), "/var/tmp")
    +                .build();
    +        sm.execScript(props, "Test script directory execution", 
ImmutableList.of(command));
         }
     
    +    @Test(groups = "Integration")
    +    public void testLocationScriptDirConfigIsRespected() throws Exception {
    +        // For explanation of (some of) the magic behind this command, see 
http://stackoverflow.com/a/229606/68898
    +        final String command = "if [[ \"$0\" == \"/var/tmp/\"* ]]; then 
true; else false; fi";
    +
    +        Map<String, Object> locationConfig = ImmutableMap.<String, 
Object>builder()
    +                .put(SshMachineLocation.SCRIPT_DIR.getName(), "/var/tmp")
    +                .build();
    +
    +        LocalhostMachineProvisioningLocation lhp = 
(LocalhostMachineProvisioningLocation) 
mgmt.getLocationRegistry().resolve("localhost", true, locationConfig).orNull();
    --- End diff --
    
    The default for the `managed` param is true, so you can just miss that out 
I think.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to