[Bug 1724342] [NEW] test_drop_privileges AssertionError groups mismatch

Corey Bryant corey.bryant at canonical.com
Tue Oct 17 18:49:44 UTC 2017


Public bug reported:

This test is failing in Ubuntu builds on Artful. However I think it
generally just gets lucky when it is successful.

======================================================================
FAIL: test_drop_privileges (test.unit.common.test_utils.TestUtils)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/<<PKGBUILDDIR>>/test/unit/common/test_utils.py", line 2151, in test_drop_privileges
    self.assertEqual(set(groups), set(os.getgroups()))
AssertionError: Items in the second set but not the first:
110
    """Fail immediately, with the given message."""
>>  raise self.failureException('Items in the second set but not the first:\n110')


It seems that setgroups() is mocked out. Part of what drop_privileges() does is:

    groups = [g.gr_gid for g in grp.getgrall() if user in g.gr_mem]
    os.setgroups(groups)

The failing part of test_drop_privileges() is:

    groups = [g.gr_gid for g in grp.getgrall() if user in g.gr_mem]
    groups.append(pwd.getpwnam(user).pw_gid)
    self.assertEqual(set(groups), set(os.getgroups()))

The test is trying to assert that os.getgroups() was set in
drop_privileges. However os.getgroups() can't change since
os.setgroups() is mocked out, and os.getgroups() isn't mocked out.

** Affects: swift
     Importance: Undecided
     Assignee: Corey Bryant (corey.bryant)
         Status: In Progress

** Affects: swift (Ubuntu)
     Importance: High
         Status: Triaged

** Also affects: swift (Ubuntu)
   Importance: Undecided
       Status: New

** Changed in: swift (Ubuntu)
       Status: New => Triaged

** Changed in: swift (Ubuntu)
   Importance: Undecided => High

** Changed in: swift
     Assignee: (unassigned) => Corey Bryant (corey.bryant)

-- 
You received this bug notification because you are a member of Ubuntu
OpenStack, which is subscribed to swift in Ubuntu.
https://bugs.launchpad.net/bugs/1724342

Title:
  test_drop_privileges AssertionError groups mismatch

Status in OpenStack Object Storage (swift):
  In Progress
Status in swift package in Ubuntu:
  Triaged

Bug description:
  This test is failing in Ubuntu builds on Artful. However I think it
  generally just gets lucky when it is successful.

  ======================================================================
  FAIL: test_drop_privileges (test.unit.common.test_utils.TestUtils)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "/<<PKGBUILDDIR>>/test/unit/common/test_utils.py", line 2151, in test_drop_privileges
      self.assertEqual(set(groups), set(os.getgroups()))
  AssertionError: Items in the second set but not the first:
  110
      """Fail immediately, with the given message."""
  >>  raise self.failureException('Items in the second set but not the first:\n110')

  
  It seems that setgroups() is mocked out. Part of what drop_privileges() does is:

      groups = [g.gr_gid for g in grp.getgrall() if user in g.gr_mem]
      os.setgroups(groups)

  The failing part of test_drop_privileges() is:

      groups = [g.gr_gid for g in grp.getgrall() if user in g.gr_mem]
      groups.append(pwd.getpwnam(user).pw_gid)
      self.assertEqual(set(groups), set(os.getgroups()))

  The test is trying to assert that os.getgroups() was set in
  drop_privileges. However os.getgroups() can't change since
  os.setgroups() is mocked out, and os.getgroups() isn't mocked out.

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



More information about the Ubuntu-openstack-bugs mailing list