Updates to Test[Sensor,HttpCall] due to assertion changes in #1049
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/3eee2f76 Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/3eee2f76 Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/3eee2f76 Branch: refs/heads/master Commit: 3eee2f76e4ca2db040b5e27dc61341a1fc4f8b1e Parents: d559ddc Author: Mark McKenna <[email protected]> Authored: Mon Nov 23 12:32:09 2015 +0000 Committer: Mark McKenna <[email protected]> Committed: Mon Nov 23 12:32:09 2015 +0000 ---------------------------------------------------------------------- .../example_yaml/entities/testhttpcall-entity.yaml | 3 ++- .../example_yaml/entities/testsensor-entity.yaml | 2 +- .../testcases/effector-test-snippet.yaml | 5 +++-- .../testcases/getting-started-test-example.yaml | 11 +++++++---- .../example_yaml/testcases/http-test-snippet.yaml | 6 ++++-- .../example_yaml/testcases/sensor-test-snippet.yaml | 2 +- docs/guide/yaml/test/test-entities.md | 15 ++++++++++----- 7 files changed, 28 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/3eee2f76/docs/guide/yaml/test/example_yaml/entities/testhttpcall-entity.yaml ---------------------------------------------------------------------- diff --git a/docs/guide/yaml/test/example_yaml/entities/testhttpcall-entity.yaml b/docs/guide/yaml/test/example_yaml/entities/testhttpcall-entity.yaml index 540b03f..bdb3347 100644 --- a/docs/guide/yaml/test/example_yaml/entities/testhttpcall-entity.yaml +++ b/docs/guide/yaml/test/example_yaml/entities/testhttpcall-entity.yaml @@ -2,5 +2,6 @@ name: Check HTTP Response Status Code url: $brooklyn:component("tomcat").attributeWhenReady("webapp.url") timeout: 60s + applyAssertionTo: status assert: - status: 200 \ No newline at end of file + - isEqualTo: 200 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/3eee2f76/docs/guide/yaml/test/example_yaml/entities/testsensor-entity.yaml ---------------------------------------------------------------------- diff --git a/docs/guide/yaml/test/example_yaml/entities/testsensor-entity.yaml b/docs/guide/yaml/test/example_yaml/entities/testsensor-entity.yaml index dbee27a..e781d0d 100644 --- a/docs/guide/yaml/test/example_yaml/entities/testsensor-entity.yaml +++ b/docs/guide/yaml/test/example_yaml/entities/testsensor-entity.yaml @@ -4,4 +4,4 @@ sensor: service.isUp timeout: 10m assert: - equals: true \ No newline at end of file + - equals: true \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/3eee2f76/docs/guide/yaml/test/example_yaml/testcases/effector-test-snippet.yaml ---------------------------------------------------------------------- diff --git a/docs/guide/yaml/test/example_yaml/testcases/effector-test-snippet.yaml b/docs/guide/yaml/test/example_yaml/testcases/effector-test-snippet.yaml index b19ff05..469b54b 100644 --- a/docs/guide/yaml/test/example_yaml/testcases/effector-test-snippet.yaml +++ b/docs/guide/yaml/test/example_yaml/testcases/effector-test-snippet.yaml @@ -7,7 +7,7 @@ sensor: service.isUp timeout: 10m assert: - equals: true + - equals: true - type: org.apache.brooklyn.test.framework.TestEffector name: Invoke Deploy Effector targetId: webappcluster @@ -23,5 +23,6 @@ $brooklyn:formatString("http://%s:%s/newcontext/", $brooklyn:component("webappcluster").attributeWhenReady("host.address"), $brooklyn:component("webappcluster").attributeWhenReady("proxy.http.port")) + applyAssertionTo: status assert: - status: 200 \ No newline at end of file + - isEqualTo: 200 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/3eee2f76/docs/guide/yaml/test/example_yaml/testcases/getting-started-test-example.yaml ---------------------------------------------------------------------- diff --git a/docs/guide/yaml/test/example_yaml/testcases/getting-started-test-example.yaml b/docs/guide/yaml/test/example_yaml/testcases/getting-started-test-example.yaml index 9735ca9..25296e6 100644 --- a/docs/guide/yaml/test/example_yaml/testcases/getting-started-test-example.yaml +++ b/docs/guide/yaml/test/example_yaml/testcases/getting-started-test-example.yaml @@ -28,8 +28,9 @@ services: $brooklyn:component("webappcluster").attributeWhenReady("host.address"), $brooklyn:component("webappcluster").attributeWhenReady("proxy.http.port")) timeout: 10m + applyAssertionTo: status assert: - status: 200 + - isEqualTo: 200 - type: org.apache.brooklyn.test.framework.TestHttpCall name: Check HTTP Response Body url: > @@ -37,8 +38,9 @@ services: $brooklyn:component("webappcluster").attributeWhenReady("host.address"), $brooklyn:component("webappcluster").attributeWhenReady("proxy.http.port")) timeout: 10m + applyAssertionTo: body assert: - regex: "(?s).*Br[o]{2}klyn Deployed.*" + - matches: "(?s).*Br[o]{2}klyn Deployed.*" - type: org.apache.brooklyn.test.framework.TestCase name: Check Deploy Effector brooklyn.children: @@ -48,7 +50,7 @@ services: sensor: service.isUp timeout: 10m assert: - equals: true + - equals: true - type: org.apache.brooklyn.test.framework.TestEffector name: Invoke Deploy Effector targetId: webappcluster @@ -64,5 +66,6 @@ services: $brooklyn:formatString("http://%s:%s/newcontext/", $brooklyn:component("webappcluster").attributeWhenReady("host.address"), $brooklyn:component("webappcluster").attributeWhenReady("proxy.http.port")) + applyAssertionTo: status assert: - status: 200 \ No newline at end of file + - isEqualTo: 200 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/3eee2f76/docs/guide/yaml/test/example_yaml/testcases/http-test-snippet.yaml ---------------------------------------------------------------------- diff --git a/docs/guide/yaml/test/example_yaml/testcases/http-test-snippet.yaml b/docs/guide/yaml/test/example_yaml/testcases/http-test-snippet.yaml index 9a52319..0a7a953 100644 --- a/docs/guide/yaml/test/example_yaml/testcases/http-test-snippet.yaml +++ b/docs/guide/yaml/test/example_yaml/testcases/http-test-snippet.yaml @@ -5,8 +5,9 @@ $brooklyn:component("webappcluster").attributeWhenReady("host.address"), $brooklyn:component("webappcluster").attributeWhenReady("proxy.http.port")) timeout: 10m + applyAssertionTo: status assert: - status: 200 + - equals: 200 - type: org.apache.brooklyn.test.framework.TestHttpCall name: Check HTTP Response Body url: > @@ -14,5 +15,6 @@ $brooklyn:component("webappcluster").attributeWhenReady("host.address"), $brooklyn:component("webappcluster").attributeWhenReady("proxy.http.port")) timeout: 10m + applyAssertionTo: body assert: - regex: "(?s).*Br[o]{2}klyn Deployed.*" \ No newline at end of file + - matches: "(?s).*Br[o]{2}klyn Deployed.*" \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/3eee2f76/docs/guide/yaml/test/example_yaml/testcases/sensor-test-snippet.yaml ---------------------------------------------------------------------- diff --git a/docs/guide/yaml/test/example_yaml/testcases/sensor-test-snippet.yaml b/docs/guide/yaml/test/example_yaml/testcases/sensor-test-snippet.yaml index 2db4074..da58cd1 100644 --- a/docs/guide/yaml/test/example_yaml/testcases/sensor-test-snippet.yaml +++ b/docs/guide/yaml/test/example_yaml/testcases/sensor-test-snippet.yaml @@ -4,4 +4,4 @@ sensor: service.isUp timeout: 10m assert: - equals: true \ No newline at end of file + - equals: true \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/3eee2f76/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 6e992e4..73eb398 100644 --- a/docs/guide/yaml/test/test-entities.md +++ b/docs/guide/yaml/test/test-entities.md @@ -47,9 +47,11 @@ The `TestSensor` entity performs an assertion on a specified sensors value. - `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, options include: - - `equals` - tests that the sensor value equals the supplied value. For example `true`. - - `regex` - tests that the sensor value matches the supplied [regex pattern](http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html?is-external=true), for example `".*hello.*"`. + - `equals`,`equalTo`,`isEqualTo` - tests that the sensor value equals the supplied value. For example `true`. + - `contains` - tests that the sensor value contains the supplied value + - `matches` - tests that the sensor value matches the supplied [regex pattern](http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html?is-external=true), for example `".*hello.*"`. - `isNull` - tests that the sensor value is `null`. + - `notNull` - tests that the sensor value is NOT `null`. ### TestEffector The `TestEffector` entity invokes the specified effector on a target entity. @@ -73,8 +75,11 @@ The `TestHttpCall` entity performs a HTTP GET on the specified URL and performs #### Parameters - `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, options include: - - `status` - response must match the specified status code, for example `200`. - - `bodyContains` - response body must contain the supplied string, for example `"hello world"`. - - `regex` - response body must match the supplied [regex pattern](http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html?is-external=true), for example `".*hello.*"` + - `equals`,`equalTo`,`isEqualTo` - tests that the value equals the supplied value. For example `true`. + - `contains` - tests that the value contains the supplied value + - `matches` - tests that the value matches the supplied [regex pattern](http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html?is-external=true), for example `".*hello.*"`. + - `isNull` - tests that the value is `null`. + - `notNull` - tests that the value is NOT `null`.
