<div dir="ltr">Now that we have switched to oslo.db for test provisioning the responsibility of choosing a location lands here: <a href="https://github.com/openstack/oslo.db/blob/a79479088029e4fa51def91cb36bc652356462b6/oslo_db/sqlalchemy/provision.py#L505">https://github.com/openstack/oslo.db/blob/a79479088029e4fa51def91cb36bc652356462b6/oslo_db/sqlalchemy/provision.py#L505</a><div><br></div><div>The problem is that when you specify <span style="font-size:12.8px">OS_TEST_DBAPI_ADMIN_</span><span style="font-size:12.8px">CONNECTION it does end up creating the file, but then the logic above chooses a URL based on the random ident. So you can find an sqlite file in your tmp dir, it just won't be the one you asked for.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">It seems like a bug in the oslo.db logic, but the commit that added it was part of a much larger refactor so I'm not sure if it was intentional to ensure that no two tests used the same db.</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 21, 2016 at 1:45 PM, Carl Baldwin <span dir="ltr"><<a href="mailto:carl@ecbaldwin.net" target="_blank">carl@ecbaldwin.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>In Neutron, we run unit tests with an in-memory sqlite instance. It is impossible, as far as I know, to inspect this database using the sqlite3 command line while the unit tests are running. So, we have to resort to python / sqlalchemy to do it. This is inconvenient.</div><div><br></div><div>Months ago, I was able to get the unit tests to write the sqlite db to a file so that I could inspect it while I was sitting at a breakpoint in the code. That was very nice. Yesterday, I tried to repeat that while traveling and was unable to figure it out. I had to time box my effort to move on to other things.</div><div><br></div><div>As far as I remember, the mechanism that I used was to adjust the neutron.conf for the tests [1]. I'm not totally sure about this because I didn't take sufficient notes, I think because it was pretty easy to figure it out at the time. This mechanism doesn't seem to have any effect these days. I changed it to 'sqlite:////tmp/unit-test.db' and never saw a file created there.</div><div><br></div><div>I did a little bit of digging and I tried one more thing. That was to set OS_TEST_DBAPI_ADMIN_CONNECTION='sqlite:////tmp/unit-test.db' in the environment before running tests. I was encouraged because this caused a file to be created at that location but the file remained empty for the duration of the run.</div><div><br></div><div>Does anyone know off the top of their head how to get unit tests in Neutron to use a file based sqlite db?</div><div><br></div><div>Carl</div><div><br></div><div>[1] <a href="https://github.com/openstack/neutron/blob/97c491294cf9eca0921336719d62d74ec4e1fa96/neutron/tests/etc/neutron.conf#L26" target="_blank">https://github.com/openstack/neutron/blob/97c491294cf9eca0921336719d62d74ec4e1fa96/neutron/tests/etc/neutron.conf#L26</a></div></div>
<br>__________________________________________________________________________<br>
OpenStack Development Mailing List (not for usage questions)<br>
Unsubscribe: <a href="http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe" rel="noreferrer" target="_blank">OpenStack-dev-request@lists.openstack.org?subject:unsubscribe</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
<br></blockquote></div><br></div>