You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by sjcorbett <gi...@git.apache.org> on 2016/06/21 17:48:50 UTC
[GitHub] brooklyn-server pull request #212: Repeat ssh tests
GitHub user sjcorbett opened a pull request:
https://github.com/apache/brooklyn-server/pull/212
Repeat ssh tests
`TestSshCommand` test repeatedly runs its command and assertions until either all the assertions pass or the configured timeout expires. Previously the class ran the command once and then ran all the assertions repeatedly until either they passed or the timeout expired.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/sjcorbett/brooklyn-server repeat-ssh-test
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/brooklyn-server/pull/212.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #212
----
commit cc3c3982b398004ba4159f2b8e5ca9d9b5b78f92
Author: Sam Corbett <sa...@cloudsoftcorp.com>
Date: 2016-06-21T17:38:40Z
Fix toString
commit a3cddf12b966fdb175175cc056d8b640a6ffee8c
Author: Sam Corbett <sa...@cloudsoftcorp.com>
Date: 2016-06-21T17:40:56Z
Fixup Javadoc
commit 4681c0d8cd860beb8b6151f5127c5ff8add8c88b
Author: Sam Corbett <sa...@cloudsoftcorp.com>
Date: 2016-06-21T17:41:03Z
Deprecate useless method
commit 404e4948b0b55e34d6f7e0af205ba76266397bef
Author: Sam Corbett <sa...@cloudsoftcorp.com>
Date: 2016-06-21T17:46:26Z
Rework TestSshCommand to re-run its command and assertions within timeout
----
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] brooklyn-server issue #212: Repeat ssh tests
Posted by aledsage <gi...@git.apache.org>.
Github user aledsage commented on the issue:
https://github.com/apache/brooklyn-server/pull/212
Yikes, well spotted! Merging now.
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] brooklyn-server pull request #212: Repeat ssh tests
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/brooklyn-server/pull/212
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] brooklyn-server pull request #212: Repeat ssh tests
Posted by aledsage <gi...@git.apache.org>.
Github user aledsage commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/212#discussion_r67935709
--- Diff: test-framework/src/test/java/org/apache/brooklyn/test/framework/TestSshCommandIntegrationTest.java ---
@@ -58,12 +62,39 @@
@Override
public void setUp() throws Exception {
super.setUp();
-
testEntity = app.createAndManageChild(EntitySpec.create(TestEntity.class)
.location(TestApplication.LOCALHOST_MACHINE_SPEC));
}
@Test(groups = "Integration")
+ public void shouldRetryCommandWithinTimeout() throws Exception {
+ TestSshCommand testWithCmd = app.createAndManageChild(EntitySpec.create(TestSshCommand.class)
+ .configure(TARGET_ENTITY, testEntity)
+ .configure(COMMAND, "_djaf-_f�39r24")
+ .configure(RUN_DIR, "/tmp")
+ .configure(TIMEOUT, Duration.TEN_SECONDS)
+ .configure(ASSERT_STATUS, makeAssertions(ImmutableMap.of(EQUALS, 0))));
+
+ // Run the test's assertions in parallel with the app.
+ Thread t = new Thread() {
+ @Override
+ public void run() {
+ app.start(ImmutableList.<Location>of());
+ }
+ };
+ t.start();
+
+ // Times out in one second.
+ EntityAsserts.assertAttributeContinuallyNotEqualTo(testWithCmd, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING);
+
+ // Replace command with a valid one and the test should start to pass.
+ testWithCmd.config().set(COMMAND, "true");
+ EntityAsserts.assertAttributeEqualsEventually(testWithCmd, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING);
+
+ t.join();
--- End diff --
I'd prefer a timeout in the join - so if we introduce something that causes the thread to not return, then the test would fail rather than hanging. But no strong feelings (given we call app.start all over the place in the main thread for tests).
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---