<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Jul 22, 2016 at 8:45 AM, Mike Bayer <span dir="ltr"><<a href="mailto:mbayer@redhat.com" target="_blank">mbayer@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
On 07/22/2016 04:02 AM, Kevin Benton wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Now that we have switched to oslo.db for test provisioning the<br>
responsibility of choosing a location lands<br>
here: <a href="https://github.com/openstack/oslo.db/blob/a79479088029e4fa51def91cb36bc652356462b6/oslo_db/sqlalchemy/provision.py#L505" rel="noreferrer" target="_blank">https://github.com/openstack/oslo.db/blob/a79479088029e4fa51def91cb36bc652356462b6/oslo_db/sqlalchemy/provision.py#L505</a><br>
<br>
The problem is that when you specify OS_TEST_DBAPI_ADMIN_CONNECTION it<br>
does end up creating the file, but then the logic above chooses a URL<br>
based on the random ident. So you can find an sqlite file in your tmp<br>
dir, it just won't be the one you asked for.<br>
<br>
It seems like a bug in the oslo.db logic, but the commit that added it<br>
was part of a much larger refactor so I'm not sure if it was intentional<br>
to ensure that no two tests used the same db.<br>
</blockquote>
<br></span>
There is also a very recent commit to Neutron at <a href="https://review.openstack.org/#/c/332476/" rel="noreferrer" target="_blank">https://review.openstack.org/#/c/332476/</a> , which I think changes the system to actually use the provisioning for the SQLite database as well, whereas before it might have been not taking effect.  But in any case, the OS_TEST_DBAPI_ADMIN_CONNECTION thing still works in that if you give it a file-based URL, provisioning should be putting the database files in /tmp.  If your approach is "pdb.set_trace(); then look at the file", just do this:<br>
<br>
$ OS_TEST_DBAPI_ADMIN_CONNECTION=sqlite:///myfile.db .tox/functional/bin/python -m unittest neutron.tests.unit.db.test_db_base_plugin_v2.TestBasicGet.test_single_get_admin<br>
<br>
> /home/classic/dev/redhat/openstack/neutron/neutron/tests/unit/db/test_db_base_plugin_v2.py(790)test_single_get_admin()<br>
-> plugin = neutron.db.db_base_plugin_v2.NeutronDbPluginV2()<br>
(Pdb)<br>
(Pdb) self.engine.url<br>
sqlite:////tmp/hjbckefatl.db<br>
<br>
then you can "sqlite3 /tmp/hjbckefatl.db" while the test is pending.<br></blockquote><div><br></div><div>Thank you, that helps. </div></div></div></div>