import pytest from lib389.utils import * from lib389.topologies import topology_m1 from lib389.idm.user import UserAccounts from lib389._constants import (DEFAULT_SUFFIX, REPLICA_RUV_FILTER, defaultProperties, REPLICATION_BIND_DN, REPLICATION_BIND_PW, REPLICATION_BIND_METHOD, REPLICATION_TRANSPORT, SUFFIX, RA_NAME, RA_BINDDN, RA_BINDPW, RA_METHOD, RA_TRANSPORT_PROT, SUFFIX) logging.getLogger(__name__).setLevel(logging.DEBUG) log = logging.getLogger(__name__) TEST_USER = "test_user" def test_ticket50103(topology_m1): """ Test that the RUV entry can be found after a full db2index """ M1 = topology_m1.ms["master1"] users = UserAccounts(M1, DEFAULT_SUFFIX) user_list = [] for i in range(10): u = users.create_test_user(uid=i) user_list.append(u) # check that the RUV can be read and is the only tombstone entry ents = M1.search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE, filterstr="(objectclass=nstombstone)") assert len(ents) == 1 M1.stop() # M1.db2index() M1.db2index(suffixes=['cn=changelog']) M1.start() # check again that the RUV can be read and is the only tombstone entry ents = M1.search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE, filterstr="(objectclass=nstombstone)") assert len(ents) == 1 if __name__ == '__main__': # Run isolated # -s for DEBUG mode CURRENT_FILE = os.path.realpath(__file__) pytest.main("-s %s" % CURRENT_FILE)