nova.tests.network.test_manager.AllocateTestCase should use mock

Bug #1357751 reported by Jay Pipes
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
bharaththiruveedula

Bug Description

Unit tests should not need to start services. Instead, they should simply mock out the specific calls out of the unit of code that is being tested.

nova.tests.network.test_manager.AllocateTestCase calls self.start_service() for the conductor, network, and compute service, and it does so unnecessarily. This results in long test run times and tests that are affected by side effects.

Remove the calls to self.start_service() and replace with proper use of mock.

Jay Pipes (jaypipes)
tags: added: low-hanging-fruit
ugvddm (271025598-9)
Changed in nova:
assignee: nobody → ugvddm (271025598-9)
Changed in nova:
assignee: ugvddm (271025598-9) → nobody
Changed in nova:
assignee: nobody → Victor Howard (victor-r-howard)
Changed in nova:
assignee: Victor Howard (victor-r-howard) → nobody
Changed in nova:
assignee: nobody → Vineet Menon (mvineetmenon)
Changed in nova:
status: Triaged → Opinion
status: Opinion → In Progress
Revision history for this message
Davanum Srinivas (DIMS) (dims-v) wrote :

Vineet, i don't see any reviews in progress, so setting this back to confirmed. please add a link to the review if/when you start one.

Changed in nova:
status: In Progress → Confirmed
Changed in nova:
assignee: Vineet Menon (mvineetmenon) → nobody
Changed in nova:
assignee: nobody → Zhenyu Zheng (zhengzhenyu)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/185860

Changed in nova:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (master)

Change abandoned by Zhenyu Zheng (<email address hidden>) on branch: master
Review: https://review.openstack.org/185860

Changed in nova:
assignee: Zhenyu Zheng (zhengzhenyu) → nobody
Revision history for this message
Sameer Adhikari (tri2sing) wrote :

First attempt at contributing code. Please help in anyway you see fit.

Changed in nova:
assignee: nobody → Sameer Adhikari (tri2sing)
Changed in nova:
assignee: Sameer Adhikari (tri2sing) → nobody
Matt Riedemann (mriedem)
Changed in nova:
status: In Progress → Confirmed
tags: added: testing
Changed in nova:
assignee: nobody → Aniruddha Singh Gautam (aniruddha-gautam)
Revision history for this message
Andrea Rosa (andrea-rosa-m) wrote :

@Aniruddha Singh Gautam are you still working on this bug?

Revision history for this message
bharaththiruveedula (bharath-ves) wrote :

@Aniruddha, May be you are occupied task and no progress on this bug, I would like to work on this bug. So I assigned this to myself. Apologies for the same.

Changed in nova:
assignee: Aniruddha Singh Gautam (aniruddha-gautam) → bharaththiruveedula (bharath-ves)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/255876

Changed in nova:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/255876
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=f92264dab59e53fa27d068bbd0f9fa4927867e14
Submitter: Jenkins
Branch: master

commit f92264dab59e53fa27d068bbd0f9fa4927867e14
Author: Bharath Thiruveedula <email address hidden>
Date: Thu Dec 10 18:42:37 2015 +0530

    Remove start_service calls from the test case

    Currently in nova.tests.unit.network.test_manager.AllocateTestCase
    start_service have been used to start nova compute and network services.
    But these calls takes most of the time while running the test cases. In
    this patch start_service method calls are removed to make test cases run
    fast.

    Change-Id: I908dc6007d66c482254f07c035e948daff2319f1
    Closes-Bug: #1357751

Changed in nova:
status: In Progress → Fix Released
Revision history for this message
Thierry Carrez (ttx) wrote : Fix included in openstack/nova 13.0.0.0b2

This issue was fixed in the openstack/nova 13.0.0.0b2 development milestone.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.