brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From geomacy <...@git.apache.org>
Subject [GitHub] incubator-brooklyn pull request: SimpleCommand addition to brookly...
Date Fri, 13 Nov 2015 14:49:43 GMT
GitHub user geomacy opened a pull request:

    https://github.com/apache/incubator-brooklyn/pull/1030

    SimpleCommand addition to brooklyn-test-framework

    ### Description
    
    An additional feature for the brooklyn-test-framework.
    
    Supports a test that runs a simple command (expected to return quickly) 
    on the host of the target entity and allows assertions to be made on the
    exit code, standard out and standard error of the command.  
    
    This is to support the use of arbitrary 'entities' (in the general sense)
    in tests using the brooklyn-test-framework.  Tests are regular blueprints
    so already allow the deployment of arbitrary Brooklyn entities. Additionally,
    to deploy arbitrary server type processes (expected to continue running),
    one can use the VanillaSoftwareProcess, which runs an arbitrary script.
    
    The SimpleCommandTest in this PR is to support a similar case to that of the 
    VanillaSoftwareProcess, except the command is expected to "do something", 
    finishing quickly, and return a result (process exit code), along with its 
    standard out and error streams, which can then be tested using assertions
    provided by the test-framework.
    
    See below for example YAML.
    
    ### Usage
    - The type is type: org.apache.brooklyn.test.framework.SimpleCommandTest.
    - The command can be specified as a script to be downloaded, by default
    to /tmp, using the "downloadUrl" flag,
    - Download directory can be changed using flag scriptDir.
    - Alternatively the command can be specified as a simple command
    to be executed, using the "defaultCommand" flag. This command can have
    bash style command syntax including pipes and redirects.
    - The command is run on the node of the target entity of the test via
    an SSH connection.
    - Assertions are made on the return code of the command using the 
    assertStatus flag, and on the standard output and error using assertOut
    and assertErr.
    
    ### TODO
    - The currently supported exceptions are equals, contains, matches and 
    isEmpty.  A TODO is to merge this with the refactored standalone assertion 
    class currently being developed for the test-framework.
    - Make the command execute against members of a cluster.  At present
    the command will only run against one of the cluster members.
    
    ### Example YAML
    ```
    name: simpleCommandTest 
    location: byon4
    services:
    - type: org.apache.brooklyn.test.framework.TestCase
      name: testcase1
      targetId: testprocess
      brooklyn.children:
        - type: org.apache.brooklyn.entity.software.base.EmptySoftwareProcess
          id: testprocess
    
        - type: org.apache.brooklyn.test.framework.SimpleCommandTest
          defaultCommand: hostname
          assertStatus:
            equals: 0
          assertOut: 
            equals: byon4
          assertErr: 
            isEmpty: true
    
        - type: org.apache.brooklyn.test.framework.SimpleCommandTest
          downloadUrl: http://localhost:8080/script1.sh
          assertStatus:
            equals: 0
          assertOut: 
            equals: hello world
          assertErr: 
            isEmpty: true
    ```

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/geomacy/incubator-brooklyn simplecommand

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-brooklyn/pull/1030.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 #1030
    
----
commit b4e3ac7b68ed26f3efa74be7285de013d1f8c02a
Author: Geoff Macartney <geoff.macartney@cloudsoftcorp.com>
Date:   2015-11-05T15:06:45Z

    Initial draft of SimpleCommand.

----


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