automated testing for inventory sync code

Charles Crouch ccrouch at redhat.com
Thu Aug 23 23:00:21 UTC 2012


Very clear write up. Can you create BZs for the different phases so we can track them.
Thanks
Charles

----- Original Message -----
> 
> 
> Inventory sync is the process by which an agent reconciles or
> synchronizes its local inventory with the server's inventory. The
> server's inventory is canonical. This means that once an inventory
> sync has finished the resources in the agent's local inventory
> should match the server's inventory (for that agent). For each
> resource the agent does some additional work to synchronize metric
> collection schedules and drift definitions. Again the goal is to
> make sure that agent's version of metric schedules and drift
> definitions is consistent with the ones on the server. The agent
> needs to ensure that collection intervals are correct and that any
> metric schedules or drift definitions that should be disabled are in
> fact disabled. These are just a couple examples of things that need
> to be kept in sync with respect to metric schedules and drift
> definitions.
> 
> 
> 
> Inventory sync is complex in large part due to the number of
> scenarios or permutations involved. For instance, there are times
> when the agent initiates a sync, and there are times when the server
> initiates the sync. Testing becomes even more of a challenge due to
> the necessary agent/server integration. This is an area (or I should
> say areas) of the code base that suffers from inadequate automated
> test coverage. I want to suggest a two phase process for increasing
> test coverage.
> 
> 
> In the first phase we need to set up some integration tests. These
> tests will involve three components - a running server, a running
> agent, and a test driver. The test driver will have two main
> responsibilities. It will coordinate work flows like starting server
> and agent, and it will perform verification. Let me illustrate with
> an example.
> 
> 
> Test Scenario: Resource exist in server inventory with drift
> definitions. Agent is started with --purgedata.
> 
> 
> Test Driver:
> 
> 
>     * Start RHQ server
>     * When server is initialized, start agent with --purgedata
>     * Wait for for agent to initialize and complete inventory sync
>     * Verify that resource along with drift definitions exist in
>     agent's inventory
> 
> 
> 
> There are some subtle details I left out here like how the test will
> know when the server has initialized or how it will know when the
> inventory sync has finished. I will save my thoughts on that for
> another discussion and instead focus on the bigger picture for now.
> Getting this infrastructure set up would require a good deal of
> work; however, it provides us with broad test coverage not possible
> with unit tests. This could also lay the foundation for other
> integration tests for things like provisioning.
> 
> 
> For phase two, we focus on unit tests. These tests will involve a
> combination of state and behavioral verification. The state
> verification should be pretty similar to the verification done in
> the integration tests - making sure the local inventory matches
> expected values. The behavioral verification will cover server-side
> calls. For example, when the agent is merging a unknown resource
> into its inventory (as would be the case when starting with
> --purgedata), we want to verify that a call is made to
> MeasurementServerService to obtain the metric collection schedules
> for that resource.
> 
> 
> 
> 
> - John
> _______________________________________________
> rhq-devel mailing list
> rhq-devel at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/rhq-devel
> 


More information about the rhq-devel mailing list