#6978 Improve TestSimpleReplication reliability
Opened 2 years ago by simo. Modified 5 months ago

Currently TestSimpleReplication usues wait_for_replication as way to wait for replication to happen and then immediately tries to fetch (one shot) an entry tht has just been created (see test_integration/test_simple_replication.py:54).

However I think this way of testing is not reliable and is a bit wasteful, we should probably change that code to just loop over fetching the entry every 1 second or so with a timeout. And fail the test if by the timeout the entry does not show up. This would be only time bound and not depend on wait_for_replication() which may give false positives in some cases I think.

This is the internal Jenkins failure that prompted failing this issue:

Regression

ipa.test_simple_replication.TestSimpleReplication.test_user_replication_to_replica (from pytest)
Failing for the past 1 build (Since Unstable#97 )
Took 12 min.
add description
Error Message

NotFound: no such entry

Stacktrace

self = <ipatests.test_integration.test_simple_replication.TestSimpleReplication object at 0x7fdcfa0f8250>

    def test_user_replication_to_replica(self):
        """Test user replication master -> replica"""
>       self.check_replication(self.master, self.replicas[0], 'testuser1')

test_integration/test_simple_replication.py:65: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
test_integration/test_simple_replication.py:54: in check_replication
    entry = ldap.get_entry(user_dn)
../ipapython/ipaldap.py:1489: in get_entry
    size_limit=size_limit
../ipapython/ipaldap.py:1317: in get_entries
    **kwargs)
../ipapython/ipaldap.py:1445: in find_entries
    break
/usr/lib64/python2.7/contextlib.py:35: in __exit__
    self.gen.throw(type, value, traceback)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <ipapython.ipaldap.LDAPClient object at 0x7fdcf8519410>, arg_desc = None

    @contextlib.contextmanager
    def error_handler(self, arg_desc=None):
        """Context manager that handles LDAPErrors
            """
        try:
            try:
                yield
            except ldap.TIMEOUT:
                raise errors.DatabaseTimeout()
            except ldap.LDAPError as e:
                desc = e.args[0]['desc'].strip()
                info = e.args[0].get('info', '').strip()
                if arg_desc is not None:
                    info = "%s arguments: %s" % (info, arg_desc)
                raise
        except ldap.NO_SUCH_OBJECT:
>           raise errors.NotFound(reason=arg_desc or 'no such entry')
E           NotFound: no such entry

../ipapython/ipaldap.py:966: NotFound

Metadata Update from @pvoborni:
- Issue set to the milestone: FreeIPA 4.6

2 years ago

Metadata Update from @tkrizek:
- Issue set to the milestone: FreeIPA 4.6.1 (was: FreeIPA 4.6)

2 years ago

Metadata Update from @tkrizek:
- Issue set to the milestone: FreeIPA 4.6.2 (was: FreeIPA 4.6.1)

2 years ago

Metadata Update from @tdudlak:
- Issue set to the milestone: FreeIPA 4.6.3 (was: FreeIPA 4.6.2)

2 years ago

Metadata Update from @rcritten:
- Issue set to the milestone: FreeIPA 4.6.4 (was: FreeIPA 4.6.3)

a year ago

FreeIPA 4.6.3 has been released, moving to FreeIPA 4.6.4 milestone

Metadata Update from @rcritten:
- Issue set to the milestone: FreeIPA 4.6.5 (was: FreeIPA 4.6.4)

a year ago

Metadata Update from @rcritten:
- Issue tagged with: tests

5 months ago

Login to comment on this ticket.

Metadata