Hello, Target resolution is relative, and you can currently test multiple levels down with the test framework, but only for groups. Have a look at the following YAML. I have a group of groups of software processes. I have a test which will loop over the first group, and run the configured entity spec against them. The configured entity spec is also a LoopOverGroupMembersTestCase, so it will loop over the children of the second level of groups (these children are the software processes).
services: > - type: org.apache.brooklyn.entity.group.BasicGroup > id: level_one > brooklyn.config: > brooklyn.BasicGroup.childrenAsMembers: true > brooklyn.children: > - type: org.apache.brooklyn.entity.group.BasicGroup > brooklyn.config: > brooklyn.BasicGroup.childrenAsMembers: true > brooklyn.children: > - type: > org.apache.brooklyn.entity.software.base.EmptySoftwareProcess > - type: > org.apache.brooklyn.entity.software.base.EmptySoftwareProcess > - type: org.apache.brooklyn.entity.group.BasicGroup > brooklyn.config: > brooklyn.BasicGroup.childrenAsMembers: true > brooklyn.children: > - type: > org.apache.brooklyn.entity.software.base.EmptySoftwareProcess > - type: > org.apache.brooklyn.entity.software.base.EmptySoftwareProcess > - type: org.apache.brooklyn.test.framework.LoopOverGroupMembersTestCase > brooklyn.config: > targetId: level_one > testSpec: > $brooklyn:entitySpec: > type: > org.apache.brooklyn.test.framework.LoopOverGroupMembersTestCase > brooklyn.config: > testSpec: > $brooklyn:entitySpec: > type: org.apache.brooklyn.test.framework.TestCase You can run that YAML in Brooklyn to get a better idea of what it does. It is all empty processes so it wont actually provision anything. I think what we are missing is a LoopOverChildrenTestCase. It would be very similar to LoopOverGroupMembersTestCase and can probably share some code. A combination of LoopOverGroupMembersTestCase followed by LoopOverChildrenTestCase should allow you to test the structure you mentioned. Regards, Graeme On 17 June 2016 at 11:24, Sam Corbett <[email protected]> wrote: > Hi, > > I want to use Brooklyn's test entities to test an app with the following > structure: > > cluster: > - member 1 > - child 1 > - member 2 > - child 2 > > The things I want to test are on the child entities. Every child has the > same CAMP id. > > LoopOverGroupMembersTestCase gets me the members, but can I get from them > to the children? Having experimented lots I currently think the answer is > no. > > I'm wondering whether there's a case for a `RelativeEntityTestCase` class, > that resolves its target relative to its parent entity. (I had assumed that > that was what LOGMTC would do, but in fact it overwrites any test spec > target with the group member.) > > Can anyone help? > > Thanks, > > Sam. >
