[Asterisk-code-review] RFC: Add runtime option that allows automatic realtime execu... (testsuite[master])

Matt Jordan asteriskteam at digium.com
Sat Dec 19 22:35:41 CST 2015


Matt Jordan has posted comments on this change.

Change subject: RFC: Add runtime option that allows automatic realtime execution.
......................................................................


Patch Set 3:

(2 comments)

https://gerrit.asterisk.org/#/c/1803/3/lib/python/asterisk/test_case.py
File lib/python/asterisk/test_case.py:

Line 232:             'asterisk-instances' in self.global_config.config):
If asterisk-instances is not in self.global_config.config, wouldn't this mean we would now return an undefined variable, as opposed to a variable that is just None?


https://gerrit.asterisk.org/#/c/1803/3/lib/python/asterisk/test_runner.py
File lib/python/asterisk/test_runner.py:

Line 327:    if (len(args) >= 4):
        :         realtime = True
        :     else:
        :         realtime = False
I've been trying to think of another way to deal with the notion of having a realtime module other than passing a command line option.

The real problem with passing a command line option is not TestRunner, nor even with TestClass. It's all the tests that have their own run-test. Even if we don't ever envision those tests making use of the 'automatic realtime' test option, we're still breaking the contract of what is passed to the run-test script. I'll grant that it's rare that we write tests in that fashion, but it is something that is a concern, and at least a reason to try and find another path.

One option would be to treat a 'realtime enabling module' as a special kind of pluggable module. Rather than having an explicit type name, or having the realtime option be enabled via a command line option, we could instead ask the pluggable module if it is a realtime enabling pluggable module. Something like this:

obj = module_type(module_config, test_object)
realtime_config = test_object.global_config.get('realtime_config')
realtime_fn = getattr(obj, 'setup_realtime', None)
if realtime_fn and realtime_config:
    realtime_fn(realtime_config)

That would eliminate the command line option, the hard coded class type name, and allow for a pluggable module that enables realtime to be defined so long as it has a function named 'setup_realtime' (or whatever we want to call it):

def setup_realtime(self, realtime_config):
    ....


-- 
To view, visit https://gerrit.asterisk.org/1803
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ieec1b1cfa48cadab108c4ab65122ce36ab697e4e
Gerrit-PatchSet: 3
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
Gerrit-HasComments: Yes



More information about the asterisk-code-review mailing list