Github user johnmccabe commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/1031#discussion_r44918698
  
    --- Diff: docs/guide/yaml/test/test-entities.md ---
    @@ -0,0 +1,72 @@
    +---
    +title: Blueprint Test Entities
    +title_in_menu: Test Entities
    +layout: website-normal
    +---
    +
    +{% include fields.md %}
    +
    +## Structural Test Entities
    +
    +### TestCase
    +The `TestCase` entity acts as a container for a list child entities which 
are started *sequentially*.
    +{% highlight yaml %}
    +{% readj example_yaml/testcase-entity.yaml %}
    +{% endhighlight %}
    +The ability to sequentially run entities is used to allow applications to 
fully deploy before attempting to start any test entities.
    +
    +If your application blueprint consists of multiple services then you will 
also require the `ParallelTestCase` entity.
    --- End diff --
    
    Both approaches are feasible, I had documented the approach that seemed 
simplest to me. We could take an agnostic approach and describe both test 
approaches, I'd prefer to have one canonical way of approaching a test though - 
both sequential and parallel have their pros and cons.
    
    For example with the parallel approach this is what an effector test would 
look like, is this more like you were thinking?
    ```
    name: Parallel Effector Test Example
    services:
    - type: org.apache.brooklyn.entity.webapp.ControlledDynamicWebAppCluster
      name: My Web
      id: webappcluster
      brooklyn.config:
        wars.root: 
http://search.maven.org/remotecontent?filepath=io/brooklyn/example/brooklyn-example-hello-world-sql-webapp/0.6.0/brooklyn-example-hello-world-sql-webapp-0.6.0.war
        java.sysprops:
          brooklyn.example.db.url: >
            $brooklyn:formatString("jdbc:%s%s?user=%s&password=%s",
            component("db").attributeWhenReady("datastore.url"),
            "visitors", "brooklyn", "br00k11n")
    - type: org.apache.brooklyn.entity.database.mariadb.MariaDbNode
      id: db
      name: My DB
      brooklyn.config:
        creationScriptUrl: https://bit.ly/brooklyn-visitors-creation-script
    - type: org.apache.brooklyn.test.framework.TestCase
      name: Test Deploy Effector
      brooklyn.children:
      - type: org.apache.brooklyn.test.framework.TestSensor
        name: webappcluster service.isUp
        targetId: webappcluster
        sensor: service.isUp
        timeout: 15m
        assert:
          equals: true
      - type: org.apache.brooklyn.test.framework.TestSensor
        name: db service.isUp
        targetId: db
        sensor: service.isUp
        timeout: 5m
        assert:
          equals: true
      - type: org.apache.brooklyn.test.framework.TestEffector
        name: Deploy WAR in /newcontext
        targetId: webappcluster
        effector: deploy
        params:
          url: 
http://search.maven.org/remotecontent?filepath=io/brooklyn/example/brooklyn-example-hello-world-sql-webapp/0.6.0/brooklyn-example-hello-world-sql-webapp-0.6.0.war
          targetName: newcontext
      - type: org.apache.brooklyn.test.framework.TestHttpCall
        name: /newcontext Status Code 200
        timeout: 5m
        url: $brooklyn:formatString("%s/newcontext/", 
component("webappcluster").attributeWhenReady("webapp.url"))
        assert:
          status: 404
    ```


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to