Github user aledsage commented on the issue:
https://github.com/apache/brooklyn-server/pull/281
Suggest you add the following tests to
`org.apache.brooklyn.entity.software.base.VanillaSoftwareProcessTest`:
@Test
public void testCmdNotInheritedByChildrenOfSoftwareProcess() throws
Exception {
app.createAndManageChild(EntitySpec.create(VanillaSoftwareProcess.class)
.configure(VanillaSoftwareProcess.PRE_INSTALL_COMMAND,
"preInstallCommand")
.configure(VanillaSoftwareProcess.LAUNCH_COMMAND,
"parentLaunchCommand")
.configure(VanillaSoftwareProcess.CHILDREN_STARTABLE_MODE,
ChildStartableMode.FOREGROUND)
.child(EntitySpec.create(VanillaSoftwareProcess.class)
.configure(VanillaSoftwareProcess.LAUNCH_COMMAND,
"childLaunchCommand")));
app.start(ImmutableList.of(loc));
assertExecHasOnlyOnce(RecordingSshTool.getExecCmds(),
"childLaunchCommand");
assertExecHasOnlyOnce(RecordingSshTool.getExecCmds(),
"preInstallCommand");
}
@Test
public void testCmdNotInheritedFromParentOfSoftwareProcess() throws
Exception {
app.config().set(VanillaSoftwareProcess.PRE_INSTALL_COMMAND,
"preInstallCommand");
app.createAndManageChild(EntitySpec.create(VanillaSoftwareProcess.class)
.configure(VanillaSoftwareProcess.LAUNCH_COMMAND,
"launchCommand"));
app.start(ImmutableList.of(loc));
assertExecHasNever(RecordingSshTool.getExecCmds(),
"preInstallCommand");
}
protected void assertExecHasNever(List<ExecCmd> actuals, String
expectedCmd) {
assertExecHasExactly(actuals, expectedCmd, 0);
}
protected void assertExecHasOnlyOnce(List<ExecCmd> actuals, String
expectedCmd) {
assertExecHasExactly(actuals, expectedCmd, 1);
}
protected void assertExecHasExactly(List<ExecCmd> actuals, String
expectedCmd, int expectedCount) {
String errMsg = "actuals="+actuals+"; expected="+expectedCmd;
int count = 0;
for (ExecCmd actual : actuals) {
for (String subActual : actual.commands) {
if (subActual.matches(expectedCmd)) {
count++;
break;
}
}
}
assertEquals(count, expectedCount, errMsg);
}
---
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.
---