db plugin sort testing function should not use sorted() on assertion

Bug #1355251 reported by Evgeny Fedoruk
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Undecided
Evgeny Fedoruk

Bug Description

tests/unit/test_db_plugin.py line 585
(https://github.com/openstack/neutron/blob/master/neutron/tests/unit/test_db_plugin.py#L585)

sorted() function is used within assertEqual() function.
This breaks tests objective which is to test sorting
Every unit test using this function (_test_list_with_sort) for sorting tests will always succeed.

sorted() should not be used for proper test results

Tags: unittest
Revision history for this message
Evgeny Fedoruk (evgenyf) wrote :

same for _test_list_with_pagination() and _test_list_with_pagination_reverse() functions

Changed in neutron:
assignee: nobody → Evgeny Fedoruk (evgenyf)
Evgeny Fedoruk (evgenyf)
Changed in neutron:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/113494
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=3082a074f819f0479fc941b30dc7cfdbb8aab394
Submitter: Jenkins
Branch: master

commit 3082a074f819f0479fc941b30dc7cfdbb8aab394
Author: Evgeny Fedoruk <email address hidden>
Date: Tue Aug 12 04:13:24 2014 -0700

    Removing sorted() function from assertEqual()

    Removing unnecessary sorted() function from assertEqual() function
    calls in functions used for sorting and pagination testing

    Using sorted() breaks sorting tests objective which is to test sorting.
    This is causing every unit test using this functions
    (_test_list_with_sort, _test_list_with_pagination, _test_list_with_pagination_reverse)
    for sorting tests to always succeed

    Switched the parameters for assertEqual() function within the fixed code to meet
    its signature - assertEqual(self, expected, observed, message='')

    Test neutron.tests.unit.vmware.vshield.test_lbaas_plugin.TestLoadbalancerPlugin.test_list_vips
    was succeeding because of this bug, although it should fail. It failed after the bug was fix.
    Test was fixed.

    Change-Id: Ia36b81d9a7fd32cae3b567ac1899b56481eb62ce
    Closes-Bug: #1355251

Changed in neutron:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in neutron:
milestone: none → juno-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in neutron:
milestone: juno-3 → 2014.2
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.