[asterisk-dev] [Code Review] 2661: Give ARI its own test object in the testsuite

Matt Jordan reviewboard at asterisk.org
Thu Aug 22 12:37:08 CDT 2013



> On Aug. 22, 2013, 4:25 p.m., David Lee wrote:
> > /asterisk/trunk/sample-yaml/ari-config.yaml.sample, lines 22-25
> > <https://reviewboard.asterisk.org/r/2661/diff/3/?file=44299#file44299line22>
> >
> >     This is now a lie, right? ari.py still doesn't honor the apps: settings.
> 
> David Lee wrote:
>     Or, at least the sample config file needs to be corrected.

No, that's correct. The test object configuration will pass the applications to subscribe for to the WebSocket client factory.

Previously the applications were specified in the event checking module configuration.


class AriTestObject(TestCase):
    ''' Class that acts as a Test Object in the pluggable module framework '''

    def __init__(self, test_path='', test_config=None):

...

        self.apps = test_config.get('apps') or 'testsuite'
        if isinstance(self.apps, list):
            self.apps = ','.join(self.apps)

...

        self.ari_factory = AriClientFactory(receiver=self, host=host, port=port,
                                        apps=self.apps,
                                        userpass=userpass)


- Matt


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/2661/#review9480
-----------------------------------------------------------


On Aug. 22, 2013, 3:58 p.m., Matt Jordan wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/2661/
> -----------------------------------------------------------
> 
> (Updated Aug. 22, 2013, 3:58 p.m.)
> 
> 
> Review request for Asterisk Developers and David Lee.
> 
> 
> Repository: testsuite
> 
> 
> Description
> -------
> 
> Testing ARI is a bit different than testing normal Asterisk tests. Typically, a test in the Asterisk Test Suite uses the following model:
> 
> 1. Create Asterisk Instances
> 2. Wait for instances to fully boot
> 3. Connect AMI
> 4. Wait for AMI connection
> 5. Spawn channels for test
> 
> Most of the test logic occurs in step number 5 - while it's possible to inject logic into the first four steps without writing a new test object, it isn't easy, particularly if what you need to do is defer the execution of one of those four steps until something else happens. In particular, ARI tests need to connect the websocket prior to step 4, as the AMI connection is what typically causes channels to be created in the dialplan and test execution to begin. If the websocket connection doesn't happen before that point, a channel may enter into the Stasis application before the websocket connects and the test will fail.
> 
> This patch gives ARI its own test object so that it can properly connect the websocket prior to the AMI connection. This changes the startup routine to be:
> 
> 1. Create Asterisk Instances
> 2. Wait for instances to fully boot
> 3. Connect ARI
> 4. Wait for ARI connection
> 5. Connection AMI
> 6. Wait for AMI connection
> 7. Spawn channels for test
> 
> It also duplicates what we currently do for starpy for Autobahn's websocket library as well, which is what the ARI test library uses for connecting to Asterisk.
> 
> 
> Diffs
> -----
> 
>   /asterisk/trunk/lib/python/asterisk/ari.py 4056 
>   /asterisk/trunk/sample-yaml/ari-config.yaml.sample 4056 
>   /asterisk/trunk/tests/rest_api/continue/configs/ast1/extensions.conf 4056 
>   /asterisk/trunk/tests/rest_api/continue/rest_continue.py 4056 
>   /asterisk/trunk/tests/rest_api/continue/test-config.yaml 4056 
> 
> Diff: https://reviewboard.asterisk.org/r/2661/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Matt Jordan
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20130822/ac0181fd/attachment-0001.htm>


More information about the asterisk-dev mailing list