brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aleds...@apache.org
Subject [2/3] brooklyn-docs git commit: Rename SimpleShellCommandTest to TestSshCommand
Date Tue, 07 Jun 2016 15:29:07 GMT
Rename SimpleShellCommandTest to TestSshCommand

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

Branch: refs/heads/master
Commit: c4479d38e56c0de96074fc494f18b6a1c31d4222
Parents: 91ae9e0
Author: Aled Sage <aled.sage@gmail.com>
Authored: Tue Jun 7 16:16:08 2016 +0100
Committer: Aled Sage <aled.sage@gmail.com>
Committed: Tue Jun 7 16:16:08 2016 +0100

----------------------------------------------------------------------
 .../entities/simpleshellcommandtest-entity.yaml | 24 ---------------
 .../entities/testsshcommand-entity.yaml         | 28 +++++++++++++++++
 guide/yaml/test/index.md                        |  2 +-
 guide/yaml/test/test-entities.md                | 32 +++++++++++++++-----
 4 files changed, 53 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-docs/blob/c4479d38/guide/yaml/test/example_yaml/entities/simpleshellcommandtest-entity.yaml
----------------------------------------------------------------------
diff --git a/guide/yaml/test/example_yaml/entities/simpleshellcommandtest-entity.yaml b/guide/yaml/test/example_yaml/entities/simpleshellcommandtest-entity.yaml
deleted file mode 100644
index 09b8339..0000000
--- a/guide/yaml/test/example_yaml/entities/simpleshellcommandtest-entity.yaml
+++ /dev/null
@@ -1,24 +0,0 @@
-- type: org.apache.brooklyn.test.framework.TestCase
-  name: testcase1
-  targetId: testprocess
-  brooklyn.children:
-    - type: org.apache.brooklyn.entity.webapp.tomcat.TomcatServer
-      id: testprocess
-
-    - type: org.apache.brooklyn.test.framework.SimpleShellCommandTest
-      command: ps -ef
-      assertStatus:
-        equals: 0
-      assertOut:
-        contains: tomcat
-      assertErr: 
-        isEmpty: true
-
-    - type: org.apache.brooklyn.test.framework.SimpleShellCommandTest
-      downloadUrl: https://github.com/apache/brooklyn-docs/raw/master/guide/yaml/test/example_yaml/entities/script1.sh
-      assertStatus:
-        equals: 0
-      assertOut: 
-        equals: hello world
-      assertErr: 
-        isEmpty: true

http://git-wip-us.apache.org/repos/asf/brooklyn-docs/blob/c4479d38/guide/yaml/test/example_yaml/entities/testsshcommand-entity.yaml
----------------------------------------------------------------------
diff --git a/guide/yaml/test/example_yaml/entities/testsshcommand-entity.yaml b/guide/yaml/test/example_yaml/entities/testsshcommand-entity.yaml
new file mode 100644
index 0000000..6bbffc0
--- /dev/null
+++ b/guide/yaml/test/example_yaml/entities/testsshcommand-entity.yaml
@@ -0,0 +1,28 @@
+services:
+- type: org.apache.brooklyn.test.framework.TestCase
+  name: testcase1
+  brooklyn.children:
+    - type: org.apache.brooklyn.entity.webapp.tomcat.TomcatServer
+      id: testprocess
+
+    - type: org.apache.brooklyn.test.framework.TestSshCommand
+      name: Check tomcat process running with ps
+      targetId: testprocess
+      command: ps -ef
+      assertStatus:
+        equals: 0
+      assertOut:
+        contains: tomcat
+      assertErr: 
+        isEmpty: true
+
+    - type: org.apache.brooklyn.test.framework.TestSshCommand
+      name: Check hello world script
+      targetId: testprocess
+      downloadUrl: https://github.com/apache/brooklyn-docs/raw/master/guide/yaml/test/example_yaml/entities/script1.sh
+      assertStatus:
+        equals: 0
+      assertOut: 
+        equals: hello world
+      assertErr: 
+        isEmpty: true

http://git-wip-us.apache.org/repos/asf/brooklyn-docs/blob/c4479d38/guide/yaml/test/index.md
----------------------------------------------------------------------
diff --git a/guide/yaml/test/index.md b/guide/yaml/test/index.md
index 02482b7..856cc73 100644
--- a/guide/yaml/test/index.md
+++ b/guide/yaml/test/index.md
@@ -20,7 +20,7 @@ Validation test entities include:
 - `TestSensor` - perform assertion on a specified sensor.
 - `TestEffector` - perform assertion on response to effector call.
 - `TestHttpCall` - perform assertion on response to specified HTTP GET Request.
-- `SimpleShellCommandTest` - test assertions on the result of a shell command on the same
node as the target entity.
+- `TestSshCommand` - test assertions on the result of an ssh command on the same machine
as the target entity.
 
 TargetableTestComponents can be chained together, with the target being inherited by the
components children. For example, a ParallelTestCase could be created that has a TestHttpCall
as a child. As long as the TestHttpCall itself does not have a target, it will use the target
of it's parent, ParallelTestCase. Using this technique, we can build up complex test scenarios.
 

http://git-wip-us.apache.org/repos/asf/brooklyn-docs/blob/c4479d38/guide/yaml/test/test-entities.md
----------------------------------------------------------------------
diff --git a/guide/yaml/test/test-entities.md b/guide/yaml/test/test-entities.md
index 8519062..a80b0aa 100644
--- a/guide/yaml/test/test-entities.md
+++ b/guide/yaml/test/test-entities.md
@@ -22,6 +22,7 @@ Timeouts on child entities should be set relative to the completion of the
prece
 
 The `ParallelTestCase` entity can be added as a child to run a subset of entities in parallel
as a single step.
 
+
 ### ParallelTestCase
 The `ParallelTestCase` entity acts as a container for a list of child entities which are
started in *parallel*.
 
@@ -33,6 +34,7 @@ This can be used to run a subset of entities in parallel as a single step
when n
 
 Timeouts on child entities should be set relative to the start of the `ParallelTestCase`.
 
+
 ### LoopOverGroupMembersTestCase
 The `LoopOverGroupMembersTestCase` entity is configured with a target group and a test specification.
For each member of the targeted group, the test case will create a TargetableTestComponent
entity from the supplied test specification and set the components target to be the group
member.
 
@@ -59,6 +61,7 @@ The `InfrastructureDeploymentTestCase` will first create and deploy an infrastru
 - `infrastructure.deployment.entity.specs` - the entities to be deployed to the infrastructure
 - `infrastructure.deployment.location.sensor` - the name of the sensor on the infrastructure
to retrieve the deployment location
 
+
 ## Validation Test Entities
 
 ### TestSensor
@@ -76,9 +79,12 @@ The `TestSensor` entity performs an assertion on a specified sensors value.
 - `assert` - assertion to perform on the specified sensor value. See section on assertions
below.
 
 <div class="alert alert-info">
-    <strong>Tip:</strong> If the <code>TestSensor</code> is wrapped
within a <code>TestCase</code>, <code>ParallelTestCase</code> or <code>LoopOverGroupMembersTestCase</code>
that set the target, <strong>you don't need to specify the target</strong>, unless
you want to test another entity.
+    <strong>Tip:</strong> If the <code>TestSensor</code> is wrapped
within a <code>TestCase</code>, 
+    <code>ParallelTestCase</code> or <code>LoopOverGroupMembersTestCase</code>
that set the target, 
+    <strong>you don't need to specify the target</strong>, unless you want to
test a different entity.
 </div>
 
+
 ### TestEffector
 The `TestEffector` entity invokes the specified effector on a target entity. If the result
of the effector is a String, it will then perform assertions on the result.
 {% highlight yaml %}
@@ -94,9 +100,12 @@ The `TestEffector` entity invokes the specified effector on a target entity.
If
 - `assert` - assertion to perform on the returned result. See section on assertions below.
 
 <div class="alert alert-info">
-    <strong>Tip:</strong> If the <code>TestEffector</code> is wrapped
within a <code>TestCase</code>, <code>ParallelTestCase</code> or <code>LoopOverGroupMembersTestCase</code>
that set the target, <strong>you don't need to specify the target</strong>, unless
you want to test another entity.
+    <strong>Tip:</strong> If the <code>TestEffector</code> is wrapped
within a <code>TestCase</code>, 
+    <code>ParallelTestCase</code> or <code>LoopOverGroupMembersTestCase</code>
that set the target, 
+    <strong>you don't need to specify the target</strong>, unless you want to
test a different entity.
 </div>
 
+
 ### TestHttpCall
 The `TestHttpCall` entity performs a HTTP GET on the specified URL and performs an assertion
on the response.
 {% highlight yaml %}
@@ -110,24 +119,28 @@ The `TestHttpCall` entity performs a HTTP GET on the specified URL and
performs
 - `assert` - assertion to perform on the response.  See section on assertions below.
 
 <div class="alert alert-info">
-    <strong>Tip:</strong> If the <code>TestHttpCall</code> is wrapped
within a <code>TestCase</code>, <code>ParallelTestCase</code> or <code>LoopOverGroupMembersTestCase</code>
that set the target, <strong>you don't need to specify the target</strong>, unless
you want to test another entity.
+    <strong>Tip:</strong> If the <code>TestHttpCall</code> is wrapped
within a <code>TestCase</code>, 
+    <code>ParallelTestCase</code> or <code>LoopOverGroupMembersTestCase</code>
that set the target, 
+    <strong>you don't need to specify the target</strong>, unless you want to
test a different entity.
 </div>
 
-### SimpleShellCommandTest
-The SimpleShellCommandTest runs a command on the host of the target entity.
+
+### TestSshCommand
+The TestSshCommand 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.
 
-Either a shell command may be provided in the YAML, or a URL for a script which will be executed.
+Either a bash command may be provided in the YAML, or a URL for a script which will be executed.
 
 {% highlight yaml %}
-{% readj example_yaml/entities/simpleshellcommandtest-entity.yaml %}
+{% readj example_yaml/entities/testsshcommand-entity.yaml %}
 {% endhighlight %}
 
 #### Parameters
 - `command` - The shell command to execute. (This and `downloadUrl` are mutually exclusive.)
 - `downloadUrl` - URL for a script to download and execute. (This and `command` are mutually
exclusive.)
+- `shell.env` - Map of environment variables to be set.
 - `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. See section on assertions
below.
@@ -135,9 +148,12 @@ Either a shell command may be provided in the YAML, or a URL for a script
which
 - `assertErr` -  Assertions on the standard error of the command as a String.
 
 <div class="alert alert-info">
-    <strong>Tip:</strong> If the <code>SimpleShellCommandTest</code>
is wrapped within a <code>TestCase</code>, <code>ParallelTestCase</code>
or <code>LoopOverGroupMembersTestCase</code> that set the target, <strong>you
don't need to specify the target</strong>, unless you want to test another entity.
+    <strong>Tip:</strong> If the <code>TestSshCommand</code> is wrapped
within a <code>TestCase</code>, 
+    <code>ParallelTestCase</code> or <code>LoopOverGroupMembersTestCase</code>
that set the target, 
+    <strong>you don't need to specify the target</strong>, unless you want to
test a different entity.
 </div>
 
+
 ## Assertions
 
 The following conditions are provided by those test entities above that include assertions


Mime
View raw message