[asterisk-dev] [Code Review]: TestSuite pre- and post-test condition check framework
mjordan
reviewboard at asterisk.org
Wed Sep 14 14:20:45 CDT 2011
> On Sept. 14, 2011, 1:56 p.m., Paul Belanger wrote:
> > /asterisk/trunk/runtests.py, line 396
> > <https://reviewboard.asterisk.org/r/1430/diff/1/?file=20549#file20549line396>
> >
> > I mentioned this before, but I don't expect bamboo to be too happy parsing this. We'll have to keep a close eye on builds after this commit.
> >
> > Basically, bamboo will default to passing, even if it cannot parse an XML file containing a failure.
Since we're having other issues with VM tests (which are currently serving as the guinea pigs for these), I think I'll comment this out for now and go with the standard failure blob. We can attempt to add the failure messages back in at a later date.
- mjordan
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/1430/#review4334
-----------------------------------------------------------
On Sept. 12, 2011, 12:01 p.m., mjordan wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1430/
> -----------------------------------------------------------
>
> (Updated Sept. 12, 2011, 12:01 p.m.)
>
>
> Review request for Asterisk Developers and Paul Belanger.
>
>
> Summary
> -------
>
> This patch provides a framework for doing pre- and post-test condition checking for an individual test run. This allows a test to take a snapshot of the state of its Asterisk instances before it executes and compare that against a snapshot of its Asterisk instances after the test executes. Depending on the test configuration, the test can either pass or fail based on whether or not resources were left uncollected in Asterisk after test execution.
>
> The place in the test workflow where the conditions are evaluated is shown below:
> main ConcreteTest TestClass TestConditionController
> test.start_asterisk ----------------->start_asterisk
>
> reactor.run -------------> run
> |--------> run
> |------------>evaluate_pre_checks()
> |
>
> test.stop_asterisk ------------------>stop_asterisk
> |------------>evaluate_post_checks()
> |
>
> All pre- and post-test condition objects must inherit from the class TestCondition. The objects are created dynamically using python reflection and registered as either a pre- or post- check based on the test-config.yaml file for each test. Post TestConditions can be set to reference the Pre-Test condition object, such that the object is supplied to the post-test object during its evaluation. This allows the post-test condition object to make its evaluation based on the initial state of Asterisk as captured by the pre-test object. TestConditions are also allowed to have 'expected failure' states set to them, in case the tests in question are known to fail.
>
> As part of this patch, a TestCondition set of objects were made to check for thread usage in Asterisk after a test. The objects ensure that after a test run, the threads currently active in Asterisk are the same threads that were active prior to the test run. The voicemail tests were updated to use this as an example.
>
> Additionally, a few other enhancements were included with this patch:
> 1. A new class that allows tests to check what build options Asterisk was compiled with
> 2. Specifying the --test option now allows for a path to be specified as opposed to a specific test. All tests under that path will be executed, e.g., --test=tests/channels/SIP/ will execute all SIP tests
> 3. XML returned by runtests.py now includes ERROR log statements in the Failure message attribute
> 4. Test configuration was moved to its own class in the asterisk libraries. All TestClass-derived tests now have access to their configuration locally.
> 5. SIPpVersion was moved to the asterisk directory, as the other sipp related classes were already there and the TestConfig class in asterisk needed to reference it
>
>
> Diffs
> -----
>
> /asterisk/trunk/lib/python/asterisk/ThreadTestCondition.py PRE-CREATION
> /asterisk/trunk/lib/python/asterisk/buildoptions.py PRE-CREATION
> /asterisk/trunk/lib/python/asterisk/TestState.py 2176
> /asterisk/trunk/lib/python/asterisk/TestConditions.py PRE-CREATION
> /asterisk/trunk/lib/python/asterisk/TestConfig.py PRE-CREATION
> /asterisk/trunk/lib/python/asterisk/TestCase.py 2176
> /asterisk/trunk/lib/python/asterisk/sippversion.py PRE-CREATION
> /asterisk/trunk/lib/python/sipp/version.py 2090
> /asterisk/trunk/runtests.py 2090
> /asterisk/trunk/tests/apps/voicemail/authenticate_nominal/run-test 2177
> /asterisk/trunk/tests/apps/voicemail/authenticate_nominal/test-config.yaml 2094
> /asterisk/trunk/tests/apps/voicemail/check_voicemail_new_user/configs/ast1/extensions.conf 2094
> /asterisk/trunk/tests/apps/voicemail/check_voicemail_new_user/run-test 2176
> /asterisk/trunk/tests/apps/voicemail/check_voicemail_new_user/test-config.yaml 2094
> /asterisk/trunk/tests/apps/voicemail/check_voicemail_nominal/configs/ast1/extensions.conf 2094
> /asterisk/trunk/tests/apps/voicemail/check_voicemail_nominal/test-config.yaml 2094
> /asterisk/trunk/tests/apps/voicemail/func_vmcount/configs/ast1/extensions.conf 2094
> /asterisk/trunk/tests/apps/voicemail/func_vmcount/test-config.yaml 2094
> /asterisk/trunk/tests/apps/voicemail/leave_voicemail_nominal/test-config.yaml 2094
>
> Diff: https://reviewboard.asterisk.org/r/1430/diff
>
>
> Testing
> -------
>
> trunk on local system.
>
>
> Thanks,
>
> mjordan
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20110914/08548914/attachment.htm>
More information about the asterisk-dev
mailing list