This seems sufficiently distinct from the other tests that we could have a new test file where we import the manager and also have direct db access. That said, I really don't like digging inside the db layer with direct queries, so hopefully we can stick to using the db api. Otherwise these tests are useless if we have a different db backend.
Vish On Sep 16, 2013, at 6:33 AM, Adalberto Medeiros <[email protected]> wrote: > Hello! > > I'm looking at where would be the most appropriate place to have the tempest > whitebox tests in nova unit tests. At first look, the > nova/tests/db/test_db_api.py seems to be an appropriate place. As previously > in tempest, I can work directly with the db and change states accordingly. > However, the logic to allow certain actions depending on instance states > seems not to be covered at this level. > > For example, one of the logic tested is try to delete an instance in vm_state > = 'resized' and task_state='resize_prep' . This should raise an Exception, > but that does not happen considering only the db level. It would require to > import manager methods in this case. > > On the other hand, having the whitebox tests on the manager test level, we > have most of db methods stubbed or use of fakes, so it wouldn't really be > doing what are expected in terms of whitebox. > > I think one option is to import the manager in the db level to apply the > needed logic, but I'm looking for more advice from the nova team and to > understand if my assumptions are correct so far. > > More information about the whitebox tests for servers in tempest (from the > patch that removes those tests): > https://review.openstack.org/#/c/46116/3/tempest/whitebox/test_servers_whitebox.py > > The nova db tests: > https://github.com/openstack/nova/blob/master/nova/tests/db/test_db_api.py > > Regards, > > -- > Adalberto Medeiros > Linux Technology Center > Openstack and Cloud Development > IBM Brazil > Email: [email protected] > > > _______________________________________________ > OpenStack-dev mailing list > [email protected] > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev _______________________________________________ OpenStack-dev mailing list [email protected] http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
