[Asterisk-code-review] Support testing realtime with ODBC (testsuite[master])

Scott Griepentrog asteriskteam at digium.com
Wed Jun 15 11:40:18 CDT 2016


Scott Griepentrog has posted comments on this change.

Change subject: Support testing realtime with ODBC
......................................................................


Patch Set 1:

(4 comments)

https://gerrit.asterisk.org/#/c/3026/1/lib/python/asterisk/realtime_odbc_module.py
File lib/python/asterisk/realtime_odbc_module.py:

PS1, Line 70:        # inform ODBC where to find them
            :         os.environ['ODBCSYSINI'] = etc
> I'm not very familiar with the requirements of ODBC, but is changing the en
Yes, since there is no service.  Even in the case where an external mysqld is being used, the ODBC instance is loaded with runtime libraries and consults the environment variable to locate it's configuration data.  When using sqlite3 as the driver, no daemon is necessary at all.

The environment variable is inherited only by child processes, thus it is available to only Asterisk and other processes started by the individual test run, and does not affect runtest.py or the originating shell.


PS1, Line 76:        inst = self._read_ini_file('/etc/odbcinst.ini')
            :         found_driver = None
            :         for section in inst:
            :             driver = inst[section].get('Driver')
            :             if driver and match_driver in driver:
            :                 found_driver = section
            :                 break
> Can you explain what the purpose of this block is? It looks like you're try
The /etc/odbcinst.ini file is conveniently updated by individual drivers automatically.  Thus when an ODBC driver such as sqlite3 is installed, it updates odbcinst.ini with an entry point to itself for convenience.  Because the name cannot be counted on to be consistent, a portion of the driver name (match_driver) is used to locate the correct entry.  That entry is then duplicated into the test-specific temporary instance of odbcinst.ini, with any changes as needed.


PS1, Line 85:             LOGGER.error('Unable to find odbcinst entry matching driver ' +
            :                          repr(driver))
> Did you mean to have match_driver here instead of driver?
Yes, I did.


PS1, Line 101:        # update the Database path if relative
             :         Database = self.odbc[dsn].get('Database', None)
             :         if Database and Database[0] != '/' and '/' in Database:
             :             self.odbc[dsn]['Database'] = '/'.join([
             :                 self.test_object.ast[0].base,
             :                 Database])
> I don't really understand what this is doing. If I have Postgres set up and
This section is specific to the sqlite3 driver, which will use a database "name" that is actually a path (with /'s) to point to the database file.  If supplied with "asterisk" or "/a/path/to/file" it will not be changed.  If supplied with "etc/asterisk/mysqlite.db" it will be prepended with the test base path so that the copy of the file from configs/ast1 will be found.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I0e20dc7354e0d4bc7d1b5d5458bdd356f1b00d26
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Scott Griepentrog <sgriepentrog at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Scott Griepentrog <sgriepentrog at digium.com>
Gerrit-HasComments: Yes



More information about the asterisk-code-review mailing list