← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1421092] [NEW] assertTableColumns always passes

 

Public bug reported:

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)

** Affects: keystone
     Importance: Undecided
     Assignee: wanghong (w-wanghong)
         Status: New

** Description changed:

  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)
+     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)

** Changed in: keystone
     Assignee: (unassigned) => wanghong (w-wanghong)

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Keystone.
https://bugs.launchpad.net/bugs/1421092

Title:
  assertTableColumns always passes

Status in OpenStack Identity (Keystone):
  New

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)

To manage notifications about this bug go to:
https://bugs.launchpad.net/keystone/+bug/1421092/+subscriptions


Follow ups

References