You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by sj...@apache.org on 2015/12/11 13:39:58 UTC

[08/15] incubator-brooklyn git commit: Add documentation for assertions and SimpleShellCommandTest.

Add documentation for assertions and SimpleShellCommandTest.


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/333eeeb1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/333eeeb1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/333eeeb1

Branch: refs/heads/master
Commit: 333eeeb15d6b4712542da64ad1adcc30f25a7e8e
Parents: 14e63fc
Author: Geoff Macartney <ge...@cloudsoftcorp.com>
Authored: Wed Dec 9 14:39:38 2015 +0000
Committer: Geoff Macartney <ge...@cloudsoftcorp.com>
Committed: Wed Dec 9 14:39:38 2015 +0000

----------------------------------------------------------------------
 .../yaml/test/example_yaml/entities/script1.sh   |  2 ++
 .../entities/simpleshellcommandtest-entity.yaml  | 13 +++++--------
 docs/guide/yaml/test/test-entities.md            | 19 +++++--------------
 3 files changed, 12 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/333eeeb1/docs/guide/yaml/test/example_yaml/entities/script1.sh
----------------------------------------------------------------------
diff --git a/docs/guide/yaml/test/example_yaml/entities/script1.sh b/docs/guide/yaml/test/example_yaml/entities/script1.sh
new file mode 100644
index 0000000..2a98304
--- /dev/null
+++ b/docs/guide/yaml/test/example_yaml/entities/script1.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+echo hello world
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/333eeeb1/docs/guide/yaml/test/example_yaml/entities/simpleshellcommandtest-entity.yaml
----------------------------------------------------------------------
diff --git a/docs/guide/yaml/test/example_yaml/entities/simpleshellcommandtest-entity.yaml b/docs/guide/yaml/test/example_yaml/entities/simpleshellcommandtest-entity.yaml
index c8217eb..3e14aa5 100644
--- a/docs/guide/yaml/test/example_yaml/entities/simpleshellcommandtest-entity.yaml
+++ b/docs/guide/yaml/test/example_yaml/entities/simpleshellcommandtest-entity.yaml
@@ -1,24 +1,21 @@
-name: simpleShellCommandTest 
-location: mybyonhost
-services:
 - type: org.apache.brooklyn.test.framework.TestCase
   name: testcase1
   targetId: testprocess
   brooklyn.children:
-    - type: org.apache.brooklyn.entity.software.base.EmptySoftwareProcess
+    - type: org.apache.brooklyn.entity.webapp.tomcat.TomcatServer
       id: testprocess
 
     - type: org.apache.brooklyn.test.framework.SimpleShellCommandTest
-      defaultCommand: hostname
+      command: ps -ef
       assertStatus:
         equals: 0
-      assertOut: 
-        equals: mybyonhost
+      assertOut:
+        contains: tomcat
       assertErr: 
         isEmpty: true
 
     - type: org.apache.brooklyn.test.framework.SimpleShellCommandTest
-      downloadUrl: http://localhost:8080/script1.sh
+      downloadUrl: https://raw.githubusercontent.com/apache/incubator-brooklyn/master/docs/guide/yaml/test/entities/script1.sh
       assertStatus:
         equals: 0
       assertOut: 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/333eeeb1/docs/guide/yaml/test/test-entities.md
----------------------------------------------------------------------
diff --git a/docs/guide/yaml/test/test-entities.md b/docs/guide/yaml/test/test-entities.md
index ddbf60b..f8eb087 100644
--- a/docs/guide/yaml/test/test-entities.md
+++ b/docs/guide/yaml/test/test-entities.md
@@ -6,15 +6,6 @@ layout: website-normal
 
 {% include fields.md %}
 
-- [Structural Test Entities](#structural-test-entities)
-  - [TestCase](#testcase)
-  - [ParallelTestCase](#paralleltestcase)
-- [Validation Test Entities](#validation-test-entities)
-  - [TestSensor](#testsensor)
-  - [TestEffector](#testeffector)
-  - [TestHttpCall](#testhttpcall)
-  - [SimpleShellCommandTest](#simpleshellcommandtest)
-- [Assertions](#assertions)
 
 ## Structural Test Entities
 
@@ -56,7 +47,7 @@ The `TestSensor` entity performs an assertion on a specified sensors value.
 - `targetId` - alternative to the `target` parameter which wraps the DSL component lookup requiring only the `id` be supplied. For example, `tomcat`.
 - `sensor` - sensor to evaluate. For example `service.isUp`.
 - `timeout` - duration to wait on assertion to return a result. For example `10s`, `10m`, etc
-- `assert` - assertion to perform on the specified sensor value.
+- `assert` - assertion to perform on the specified sensor value. See section on assertions below.
 
 ### TestEffector
 The `TestEffector` entity invokes the specified effector on a target entity.
@@ -81,12 +72,12 @@ The `TestHttpCall` entity performs a HTTP GET on the specified URL and performs
 - `url` - URL to perform GET request on, this can use DSL for example `$brooklyn:component("tomcat").attributeWhenReady("webapp.url")`.
 - `timeout` - duration to wait on a HTTP response. For example `10s`, `10m`, etc
 - `applyAssertionTo` - The filed to apply the assertion to. For example `status`, `body`
-- `assert` - assertion to perform on the response.
+- `assert` - assertion to perform on the response.  See section on assertions below.
 
 ### SimpleShellCommandTest
 
-The purpose of a SimpleShellCommandTest is to run a command, on the host of the target entity,
-that is expected to "do something", finishing quickly, and return a result (process exit code), along with its 
+The SimpleShellCommandTest runs a command on the host of the target entity.
+The script is expected not to run indefinitely, but to return a result (process exit code), along with its 
 standard out and error streams, which can then be tested using assertions.
 If no assertions are explicitly configured, the default is to assert a non-zero exit code.
 
@@ -101,7 +92,7 @@ Either a shell command may be provided in the YAML, or a URL for a script which
 - `downloadUrl` - URL for a script to download and execute. (This and `command` are mutually exclusive.)
 - `scriptDir` - if `downloadUrl` is used.  The directory on the target host where downloaded scripts should be copied to.
 - `runDir` - the working directory where the command or script will be executed on the target host.
-- `assertStatus` - Assertions on the exit code of the command or script. 
+- `assertStatus` - Assertions on the exit code of the command or script. See section on assertions below.
 - `assertOut` - Assertions on the standard output of the command as a String.
 - `assertErr` -  Assertions on the standard error of the command as a String.