assertTableColumns always passes

Bug #1421092 reported by wanghong
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Fix Released
Medium
wanghong

Bug Description

assertTableColumns method in tests/test_sql_upgrade.py is used to asserts that the table contains the expected set of columns. But, it always passes because the return of sort method is None:
https://github.com/openstack/keystone/blob/master/keystone/tests/test_sql_upgrade.py#L265
    def assertTableColumns(self, table_name, expected_cols):
        """Asserts that the table contains the expected set of columns."""
        self.initialize_sql()
        table = self.select_table(table_name)
        actual_cols = [col.name for col in table.columns]
        # Check if the columns are equal, but allow for a different order,
        # which might occur after an upgrade followed by a downgrade
        self.assertEqual(expected_cols.sort(), actual_cols.sort(),
                         '%s table' % table_name)

wanghong (w-wanghong)
description: updated
Changed in keystone:
assignee: nobody → wanghong (w-wanghong)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to keystone (master)

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

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

Reviewed: https://review.openstack.org/155215
Committed: https://git.openstack.org/cgit/openstack/keystone/commit/?id=43e129cea973c9502fc42f56e05b5b858b144fda
Submitter: Jenkins
Branch: master

commit 43e129cea973c9502fc42f56e05b5b858b144fda
Author: wanghong <email address hidden>
Date: Thu Feb 12 15:33:36 2015 +0800

    fix assertTableColumns

    assertTableColumns method is used to asserts that the table contains
    the expected set of columns. There is a assert in assertTableColumns:
    self.assertEqual(expected_cols.sort(), actual_cols.sort()).
    However, the return of List.sort is None. So, this assert always
    passes.

    Change-Id: I4b5e48044cb466b1660484043b475ac6e2d9b35e
    Closes-Bug: #1421092

Changed in keystone:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in keystone:
milestone: none → kilo-3
status: Fix Committed → Fix Released
Dolph Mathews (dolph)
Changed in keystone:
importance: Undecided → Medium
Thierry Carrez (ttx)
Changed in keystone:
milestone: kilo-3 → 2015.1.0
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.