#3537 NSS: Group memcache not working in pytest
Closed: worksforme 6 years ago Opened 6 years ago by mzidek.

The title may be a little bit misleading, because we do test group memcache in pytest, but this particular scenario does not work for some reason:

def test_memcaches(ldap_conn, sanity_rfc2307):
    ent.assert_passwd_by_name(
        'user1',
        dict(name='user1', passwd='*', uid=1001, gid=2001,
             gecos='1001', shell='/bin/bash'))
    ent.assert_passwd_by_uid(
        1001,
        dict(name='user1', passwd='*', uid=1001, gid=2001,
             gecos='1001', shell='/bin/bash'))

    ent.assert_group_by_name("group1", dict(name="group1", gid=2001))
    ent.assert_group_by_gid(2001, dict(name="group1", gid=2001))

    stop_sssd()

    ent.assert_passwd_by_name(
        'user1',
        dict(name='user1', passwd='*', uid=1001, gid=2001,
             gecos='1001', shell='/bin/bash'))
    ent.assert_passwd_by_uid(
        1001,
        dict(name='user1', passwd='*', uid=1001, gid=2001,
             gecos='1001', shell='/bin/bash'))

    # passwd cache is disabled
    with pytest.raises(KeyError):
        pwd.getpwnam('user1')
    with pytest.raises(KeyError):
        pwd.getpwuid(1001)

    ent.assert_group_by_name("group1", dict(name="group1", gid=2001))
    ent.assert_group_by_gid(2001, dict(name="group1", gid=2001)

The other tests for group memcache are working. As seen in the code snippet, the passwd memcache works fine even in this scenario, because the test fails on the asserts for group requests.


I think this is low priority, because I was only able to reproduce this in the pytest environment so far. But nevertheless it does look like a bug.

Metadata Update from @jhrozek:
- Issue set to the milestone: SSSD Continuous integration

6 years ago

Next time please attach test as a diff/patch instead of pasting it as a comment.
Or even better provide also link to git branch. Becasue there is missing bracket on last line.

Following part will fail with current master because it is unsupported an unimplemented.

    # passwd cache is disabled
    with pytest.raises(KeyError):
        pwd.getpwnam('user1')
    with pytest.raises(KeyError):
        pwd.getpwuid(1001)

Otherwise test passed with current master.
I used following branch for testing on my local machine and also in CI.
https://pagure.io/fork/lslebodn/SSSD/sssd/commits/ticket3537

http://vm-058-233.$ABC/logs/job/78/74/summary.html

Metadata Update from @lslebodn:
- Issue close_status updated to: worksforme
- Issue set to the milestone: None (was: SSSD Continuous integration)
- Issue status updated to: Closed (was: Open)

6 years ago

SSSD is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in SSSD's github repository.

This issue has been cloned to Github and is available here:
- https://github.com/SSSD/sssd/issues/4563

If you want to receive further updates on the issue, please navigate to the github issue
and click on subscribe button.

Thank you for understanding. We apologize for all inconvenience.

Login to comment on this ticket.

Metadata