[openstack-dev] [neutron] questions about uni test

Henry Gessau HenryG at gessau.net
Mon Jan 25 19:15:17 UTC 2016


Gareth <academicgareth at gmail.com> wrote:
> It creates and cleans the tables in memory?

Creates and deletes actually.

Line 69 creates all the tables when a test starts.

Line 78 uses the unittest framework to add the function clear_tables() to the
post-test operations that are run after every test. So after a test finishes,
all the tables will be deleted by line 76.


Neutron's unit test framework uses a sqlite in-memory database, yes. This is
configured by [1].

[1]
https://github.com/openstack/neutron/blob/master/neutron/tests/etc/neutron.conf#L26


> 
> On Tue, Jan 26, 2016 at 12:56 AM, Assaf Muller <amuller at redhat.com> wrote:
>> On Mon, Jan 25, 2016 at 10:05 AM, Gareth <academicgareth at gmail.com> wrote:
>>> Hey neutron guys
>>>
>>> What will happen if I remove this line[0]?
>>>
>>> When running unit test, do we create tables in real database?
>>>
>>> [0] https://github.com/openstack/neutron/blob/master/neutron/tests/unit/testlib_api.py#L78
>>
>> That line has nothing to do with what database backend you use (SQLite
>> or mysql or whatever), it's used to clear the contents of the tables
>> so the next test starts with a clean DB.
>>
>>>
>>> --
>>> Gareth (Kun Huang)
>>>
>>> Cloud Computing, OpenStack, Distributed Storage, Fitness, Basketball
>>> OpenStack contributor, kun_huang at freenode
>>> My promise: if you find any spelling or grammar mistakes in my email
>>> from Mar 1 2013, notify me
>>> and I'll donate $1 or ¥1 to an open organization you specify.
>>>
>>> __________________________________________________________________________
>>> OpenStack Development Mailing List (not for usage questions)
>>> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
>>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>>
>> __________________________________________________________________________
>> OpenStack Development Mailing List (not for usage questions)
>> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
> 
> 
> 




More information about the OpenStack-dev mailing list