brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aledsage <...@git.apache.org>
Subject [GitHub] incubator-brooklyn pull request: Updates to Test framework asserti...
Date Mon, 30 Nov 2015 17:26:54 GMT
Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/1066#discussion_r46174015
  
    --- Diff: usage/test-framework/src/test/java/org/apache/brooklyn/test/framework/SimpleShellCommandIntegrationTest.java
---
    @@ -96,15 +102,70 @@ public void shouldInsistOnJustOneOfCommandAndScript(String command,
String scrip
             }
         }
     
    +    private List<Map<String, Object>> makeAssertions(Map<String, Object>
...maps) {
    +        ArrayList<Map<String, Object>> assertions = new ArrayList<>();
    +        for (Map<String, Object> map : maps) {
    +            assertions.add(map);
    +        }
    +        return assertions;
    +    }
    +
    +
    +
    +    @Test(groups = "Integration")
    +    public void shouldSucceedUsingSuccessfulExitAsDefaultCondition() {
    +        TestEntity testEntity = app.createAndManageChild(EntitySpec.create(TestEntity.class).location(machine));
    +
    +        SimpleShellCommandTest uptime = app.createAndManageChild(EntitySpec.create(SimpleShellCommandTest.class)
    +            .configure(TARGET_ENTITY, testEntity)
    +            .configure(COMMAND, "uptime"));
    +
    +        app.start(ImmutableList.of(loc));
    +
    +        assertThat(uptime.sensors().get(SERVICE_UP)).isTrue()
    +            .withFailMessage("Service should be up");
    +        assertThat(ServiceStateLogic.getExpectedState(uptime)).isEqualTo(Lifecycle.RUNNING)
    +            .withFailMessage("Service should be marked running");
    +    }
    +
    +
    +    @Test(groups = "Integration")
    +    public void shouldFailUsingSuccessfulExitAsDefaultCondition() {
    +        TestEntity testEntity = app.createAndManageChild(EntitySpec.create(TestEntity.class).location(machine));
    +
    +        SimpleShellCommandTest uptime = app.createAndManageChild(EntitySpec.create(SimpleShellCommandTest.class)
    +            .configure(TARGET_ENTITY, testEntity)
    +            .configure(COMMAND, "ls /tmp/bogus-" + Identifiers.randomLong()));
    +
    +        try {
    +            app.start(ImmutableList.of(loc));
    --- End diff --
    
    Do we need to fail if the exception was not thrown?


---
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.
---

Mime
View raw message