Repository: brooklyn-server Updated Branches: refs/heads/master f0a2995b4 -> 176977124
speed up a ssh feed test, from 5s to 20ms Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/a2a6ae28 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/a2a6ae28 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/a2a6ae28 Branch: refs/heads/master Commit: a2a6ae288622d7cec396084376735d1f77c09328 Parents: b141425 Author: Alex Heneveld <alex.henev...@cloudsoftcorp.com> Authored: Fri Sep 14 23:38:36 2018 +0100 Committer: Alex Heneveld <alex.henev...@cloudsoftcorp.com> Committed: Fri Sep 14 23:38:36 2018 +0100 ---------------------------------------------------------------------- .../core/mgmt/rebind/RebindHistoricSshCommandSensorTest.java | 8 ++++++-- .../core/mgmt/rebind/ssh-command-sensor-feed-a9ekg3cnu0 | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a2a6ae28/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindHistoricSshCommandSensorTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindHistoricSshCommandSensorTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindHistoricSshCommandSensorTest.java index 9c92326..cd56d65 100644 --- a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindHistoricSshCommandSensorTest.java +++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindHistoricSshCommandSensorTest.java @@ -28,6 +28,8 @@ import org.apache.brooklyn.location.ssh.SshMachineLocation; import org.apache.brooklyn.test.Asserts; import org.apache.brooklyn.util.core.internal.ssh.RecordingSshTool; import org.apache.brooklyn.util.core.internal.ssh.RecordingSshTool.ExecCmd; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -36,6 +38,7 @@ import com.google.common.collect.ImmutableList; public class RebindHistoricSshCommandSensorTest extends AbstractRebindHistoricTest { + private static final Logger log = LoggerFactory.getLogger(RebindHistoricSshCommandSensorTest.class); private static final String BLACKHOLE_IP = "240.0.0.1"; @Override @@ -89,9 +92,10 @@ public class RebindHistoricSshCommandSensorTest extends AbstractRebindHistoricTe .configure("address", BLACKHOLE_IP) .configure(SshMachineLocation.SSH_TOOL_CLASS, RecordingSshTool.class.getName())); entity.addLocations(ImmutableList.of(recordingLocalhostMachine)); - + // odd, if this _class_ is run it waits the full period before running the feed; + // but if this _test_ is run on its own it runs immediately. + // reduced period to 20ms in persisted state and now it always runs immediately. ExecCmd cmd = Asserts.succeedsEventually(() -> RecordingSshTool.getLastExecCmd()); - assertTrue(cmd.commands.toString().contains("echo 'myval'"), "cmds="+cmd.commands); assertEquals(cmd.env.get("MY_ENV"), "myEnvVal", "env="+cmd.env); assertTrue(cmd.commands.toString().contains("/path/to/myexecutiondir"), "cmds="+cmd.commands); http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a2a6ae28/core/src/test/resources/org/apache/brooklyn/core/mgmt/rebind/ssh-command-sensor-feed-a9ekg3cnu0 ---------------------------------------------------------------------- diff --git a/core/src/test/resources/org/apache/brooklyn/core/mgmt/rebind/ssh-command-sensor-feed-a9ekg3cnu0 b/core/src/test/resources/org/apache/brooklyn/core/mgmt/rebind/ssh-command-sensor-feed-a9ekg3cnu0 index 240ff30..f0bb95f 100644 --- a/core/src/test/resources/org/apache/brooklyn/core/mgmt/rebind/ssh-command-sensor-feed-a9ekg3cnu0 +++ b/core/src/test/resources/org/apache/brooklyn/core/mgmt/rebind/ssh-command-sensor-feed-a9ekg3cnu0 @@ -59,7 +59,7 @@ under the License. <config> <name>myconf</name> <targetType>String</targetType> - <period>5s</period> + <period>20ms</period> <command>echo 'myval'</command> <shell.env> <map> @@ -124,7 +124,7 @@ under the License. <logWarningGraceTime> <nanos>0</nanos> </logWarningGraceTime> - <period>5000</period> + <period>20</period> <commandSupplier class="org.apache.brooklyn.core:org.apache.brooklyn.core.sensor.ssh.SshCommandSensor$2" reference="../../org.apache.brooklyn.core:org.apache.brooklyn.feed.AbstractCommandFeed_-CommandPollIdentifier/command"/> <dynamicEnvironmentSupplier class="MutableList" serialization="custom"> <unserializable-parents/>