Remove duplicated tests code in Nova tests

Registered by Alexei Kornienko on 2013-06-21

Lots of code in nova tests is duplicated.
This blueprint is a summary list of problem places that needs to be worked on

We should create separate classes for different methods tests to improve tests setUp code.
Tests should be refactored to remove duplicated code and improve test assertions.

Blueprint information

Status:
Complete
Approver:
Russell Bryant
Priority:
Low
Drafter:
Alexei Kornienko
Direction:
Approved
Assignee:
Alexei Kornienko
Definition:
Approved
Series goal:
Accepted for havana
Implementation:
Implemented
Milestone target:
milestone icon 2013.2
Started by
Russell Bryant on 2013-06-27
Completed by
Russell Bryant on 2013-08-22

Related branches

Sprints

Whiteboard

Currently this tests have following problems:
1) Different tests use different methods to setup fixtures and stubs
2) A lot of setup code is duplicated
3) Test classes a too big and should be separated in smaller ones
4) Some tests assertions are quite bad and not actually asserting anything
5) some test code can be organized a little bit to create simple DSL like methods to help understand main test goal
6) need to add several tests to improve tests coverage
alexei_987

Gerrit topic: https://review.openstack.org/#q,topic:bp/api-compute-servers-tests,n,z

Addressed by: https://review.openstack.org/34357
    Moved tests for server.delete

Addressed by: https://review.openstack.org/34358
    Removed code duplication in api.compute.servers tests

Addressed by: https://review.openstack.org/34538
    Moved tests for server._action_rebuild

Addressed by: https://review.openstack.org/34556
    Code dedup in tests for server._action_rebuild

Addressed by: https://review.openstack.org/34748
    Refactor TestAddressesXMLSerialization class.

Gerrit topic: https://review.openstack.org/#q,topic:api-compute-servers-tests,n,z

Addressed by: https://review.openstack.org/34849
    Refactor test_update_* from test_servers.py in current API tests and v3.

Addressed by: https://review.openstack.org/35124
    Refactor class ServersControllerCreateTest

Addressed by: https://review.openstack.org/35131
    Refactor ServerStatusTest class

Addressed by: https://review.openstack.org/35257
    Ref?ctor test_quota_sets.

Gerrit topic: https://review.openstack.org/#q,topic:nova-tests-code-duplication,n,z

Addressed by: https://review.openstack.org/35271
    Refactor test_evacuate.

Gerrit topic: https://review.openstack.org/#q,topic:bp/nova-tests-code-duplication,n,z

Addressed by: https://review.openstack.org/35277
    Refactor class ImageXMLSerializationTest

Addressed by: https://review.openstack.org/35288
    Refactor ServersViewBuilderTest class.

Addressed by: https://review.openstack.org/35469
    Refactor class ImagesControllerTest

Addressed by: https://review.openstack.org/35623
    Refactor class TestServerActionRequestXMLDeserializer

Addressed by: https://review.openstack.org/35768
    Move tests in virt.libvirt.test_imagecache

Addressed by: https://review.openstack.org/35763
    Refactor test_libvirt_vif

Addressed by: https://review.openstack.org/35805
    Make ServerXMLSerializationTest DRYer

Addressed by: https://review.openstack.org/36031
    Refactor virt.libvirt.test_imagecache.test_verify_checksum_*

Addressed by: https://review.openstack.org/36032
    Refactor test_libvirt_volume

Addressed by: https://review.openstack.org/36204
    Refactor class InstanceTypeExtraSpecsTestCase

Addressed by: https://review.openstack.org/36217
    Refactor class QuotaReserveSqlAlchemyTestCase

Addressed by: https://review.openstack.org/39653
    Make EvacuateTest DRYer

Addressed by: https://review.openstack.org/39883
    Move tests test_update_* to separate class

Addressed by: https://review.openstack.org/39900
    Code dedup in test_update_*

Addressed by: https://review.openstack.org/40210
    Refactor unittest for extensions os-images v3

(?)

Work Items

Work items:
[alexei-kornienko] test_delete_server_* : DONE
[alexei-kornienko] test_get_server_* : DONE
[akamyshnikova] test_rebuild_instance_*: INPROGRESS
[akamyshnikova] class ServersControllerCreateTest : DONE
[akamyshnikova] class ImageXMLSerializationTest : DONE
[akamyshnikova] virt.libvirt.test_libvirt_vif.: DONE
[akamyshnikova] virt.libvirt.test_libvirt_volume.: DONE
[eyuzlikeev] plugins.v3.test_quota_sets: INPROGRESS
[eyuzlikeev] plugins.v3.test_evacuate: DONE
[eyuzlikeev] virt.libvirt.test_libvirt: INPROGRESS
[a-gorodnev] class TestAddressesXMLSerialization: DONE
[a-gorodnev] class ServersViewBuilderTest: DONE
[a-gorodnev] class ServerXMLSerializationTest: DONE
[a-gordeev] class ServerStatusTest: DONE
[eezhova] test_update_* : DONE
[eezhova] class ImagesControllerTest: DONE
[eezhova] class TestServerActionRequestXMLDeserializer: DONE
[eezhova] virt.libvirt.test_imagecache.test_verify_checksum_*: DONE
[eezhova] class InstanceTypeExtraSpecsTestCase: DONE
[eezhova] class QuotaReserveSqlAlchemyTestCase: DONE

This blueprint contains Public information 
Everyone can see this information.