Github user aledsage commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/225#discussion_r69444633
--- Diff:
test-framework/src/test/java/org/apache/brooklyn/test/framework/TestSshCommandTest.java
---
@@ -278,6 +274,28 @@ public void shouldFailIfTestEntityHasNoMachine()
throws Exception {
}
@Test
+ public void shouldFailFastIfNoCommand() throws Exception {
+ Map<String, ?> equalsZero = ImmutableMap.of(EQUALS, 0);
+
+ TestSshCommand test =
app.createAndManageChild(EntitySpec.create(TestSshCommand.class)
+ .configure(TIMEOUT, Duration.ONE_MINUTE)
+ .configure(TARGET_ENTITY, testEntity)
+ .configure(ASSERT_STATUS, makeAssertions(equalsZero)));
+
+ Stopwatch stopwatch = Stopwatch.createStarted();
+ try {
+ app.start(ImmutableList.<Location>of());
+ Asserts.shouldHaveFailedPreviously();
+ } catch (Exception e) {
+ Asserts.expectedFailureContains(e, "Must specify exactly one
of download.url and command");
+ Duration elapsed = Duration.of(stopwatch);
+
Asserts.assertTrue(elapsed.isShorterThan(Duration.THIRTY_SECONDS),
"elapsed="+elapsed);
+ }
+
+ assertServiceFailed(test);
+ }
--- End diff --
Not convinced by that opposite test (it's really a race, whether we manage
to spot that the target is not there before it is created).
However, I am adding a couple of tests motivated by this: that we fail if
the target does not exist (in both the case where there is and is not a
TARGET_RESOLUTION_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 [email protected] or file a JIRA ticket
with INFRA.
---