#6024 'test_user_plugin' and UserTracker do not handle test cases renaming users
Closed: Fixed None Opened 7 years ago by mbabinsk.

user, host, and service objects now return krbprincipalname/krbcanonicalname attributes after add, mod, and find operations on them.

In case of users, canonical name and the corresponding alias are changed when the user is renamed. The current UserTracker implementation does not count with this resulting in false negative tests results like this

=================================== FAILURES ===================================
____________________________ TestUpdate.test_rename ____________________________

self = <ipatests.test_xmlrpc.test_user_plugin.TestUpdate object at 0x7fb6ec508b10>
user = <ipatests.test_xmlrpc.tracker.user_plugin.UserTracker object at 0x7fb6ec56fb90>
renameduser = <ipatests.test_xmlrpc.tracker.user_plugin.UserTracker object at 0x7fb6ec508a10>

    def test_rename(self, user, renameduser):
        """ Rename user and than rename it back """
        user.ensure_exists()
        renameduser.ensure_missing()
        olduid = user.uid

        # using user.update(dict(uid=value)) results in
        # OverlapError: overlapping arguments and options: ['uid']
        user.attrs.update(uid=[renameduser.uid])
        command = user.make_update_command(
            updates=dict(setattr=(u'uid=%s' % renameduser.uid))
        )
        result = command()
>       user.check_update(result)

test_xmlrpc/test_user_plugin.py:326:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test_xmlrpc/tracker/user_plugin.py:313: in check_update
    ), result)
util.py:361: in assert_deepequal
    assert_deepequal(e_sub, g_sub, doc, stack + (key,))
util.py:361: in assert_deepequal
    assert_deepequal(e_sub, g_sub, doc, stack + (key,))
util.py:349: in assert_deepequal
    assert_deepequal(e_sub, g_sub, doc, stack + (i,))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

expected = 'user1@TEST.REALM'
got = 'ruser1@TEST.REALM', doc = ''
stack = ('result', 'krbcanonicalname', 0)

The first failure causes the whole chain of rename tests to fail due to fragile logic of test_rename method. We need to make tracker aware of the fact that renaming entry can cause changes in attributes other than RDN, and decouple the individual rename tests so that their results do not depend on each other.


master:

  • 9093647 Tests: Improve handling of rename operation by user tracker

Metadata Update from @mbabinsk:
- Issue assigned to lryznaro
- Issue set to the milestone: FreeIPA 4.4.1

6 years ago

Login to comment on this ticket.

Metadata