Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 6224 - Remove test_referral_subsuffix from ds_logs_test.py #6457

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
215 changes: 0 additions & 215 deletions dirsrvtests/tests/suites/ds_logs/ds_logs_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1285,221 +1285,6 @@ def fin():

request.addfinalizer(fin)

def test_referral_subsuffix(topology_st, request):
"""Test the results of an inverted parent suffix definition in the configuration.

For more details see:
https://www.port389.org/docs/389ds/design/mapping_tree_assembly.html

:id: 4faf210a-4fde-4e4f-8834-865bdc8f4d37
:setup: Standalone instance
:steps:
1. First create two Backends, without mapping trees.
2. create the mapping trees for these backends
3. reduce nsslapd-referral-check-period to accelerate test
4. Remove error log file
5. Create a referral entry on parent suffix
6. Check that the server detected the referral
7. Delete the referral entry
8. Check that the server detected the deletion of the referral
9. Remove error log file
10. Create a referral entry on child suffix
11. Check that the server detected the referral on both parent and child suffixes
12. Delete the referral entry
13. Check that the server detected the deletion of the referral on both parent and child suffixes
14. Remove error log file
15. Create a referral entry on parent suffix
16. Check that the server detected the referral on both parent and child suffixes
17. Delete the child referral entry
18. Check that the server detected the deletion of the referral on child suffix but not on parent suffix
19. Delete the parent referral entry
20. Check that the server detected the deletion of the referral parent suffix

:expectedresults:
all steps succeeds
"""
inst = topology_st.standalone
topology_st.standalone.restart()
# Step 1 First create two Backends, without mapping trees.
PARENT_SUFFIX='dc=parent,dc=com'
CHILD_SUFFIX='dc=child,%s' % PARENT_SUFFIX
be1 = create_backend(inst, 'Parent', PARENT_SUFFIX)
be2 = create_backend(inst, 'Child', CHILD_SUFFIX)
# Step 2 create the mapping trees for these backends
mts = MappingTrees(inst)
mt1 = mts.create(properties={
'cn': PARENT_SUFFIX,
'nsslapd-state': 'backend',
'nsslapd-backend': 'Parent',
})
mt2 = mts.create(properties={
'cn': CHILD_SUFFIX,
'nsslapd-state': 'backend',
'nsslapd-backend': 'Child',
'nsslapd-parent-suffix': PARENT_SUFFIX,
})

dc_ex = Domain(inst, dn=PARENT_SUFFIX)
assert dc_ex.exists()

dc_st = Domain(inst, dn=CHILD_SUFFIX)
assert dc_st.exists()

# Step 3 reduce nsslapd-referral-check-period to accelerate test
# requires a restart done on step 4
REFERRAL_CHECK=7
topology_st.standalone.config.set("nsslapd-referral-check-period", str(REFERRAL_CHECK))

# Check that if we create a referral at parent level
# - referral is detected at parent backend
# - referral is not detected at child backend

# Step 3 Remove error log file
topology_st.standalone.stop()
lpath = topology_st.standalone.ds_error_log._get_log_path()
os.unlink(lpath)
topology_st.standalone.start()

# Step 4 Create a referral entry on parent suffix
REFERRAL_DN = "cn=my_ref,%s" % PARENT_SUFFIX
properties = ({'cn': 'my_ref',
'uid': 'my_ref',
'sn': 'my_ref',
'uidNumber': '1000',
'gidNumber': '2000',
'homeDirectory': '/home/testuser',
'description': 'referral entry',
'objectclass': "top referral extensibleObject".split(),
'ref': 'ref: ldap://remote/%s' % REFERRAL_DN})
referral = UserAccount(inst, REFERRAL_DN)
referral.create(properties=properties)

# Step 5 Check that the server detected the referral
time.sleep(REFERRAL_CHECK + 1)
assert topology_st.standalone.ds_error_log.match('.*slapd_daemon - New referral entries are detected under %s.*' % PARENT_SUFFIX)
assert not topology_st.standalone.ds_error_log.match('.*slapd_daemon - New referral entries are detected under %s.*' % CHILD_SUFFIX)
assert not topology_st.standalone.ds_error_log.match('.*slapd_daemon - No more referral entry under %s' % PARENT_SUFFIX)

# Step 6 Delete the referral entry
referral.delete()

# Step 7 Check that the server detected the deletion of the referral
time.sleep(REFERRAL_CHECK + 1)
assert topology_st.standalone.ds_error_log.match('.*slapd_daemon - No more referral entry under %s' % PARENT_SUFFIX)

# Check that if we create a referral at child level
# - referral is detected at parent backend
# - referral is detected at child backend

# Step 8 Remove error log file
topology_st.standalone.stop()
lpath = topology_st.standalone.ds_error_log._get_log_path()
os.unlink(lpath)
topology_st.standalone.start()

# Step 9 Create a referral entry on child suffix
REFERRAL_DN = "cn=my_ref,%s" % CHILD_SUFFIX
properties = ({'cn': 'my_ref',
'uid': 'my_ref',
'sn': 'my_ref',
'uidNumber': '1000',
'gidNumber': '2000',
'homeDirectory': '/home/testuser',
'description': 'referral entry',
'objectclass': "top referral extensibleObject".split(),
'ref': 'ref: ldap://remote/%s' % REFERRAL_DN})
referral = UserAccount(inst, REFERRAL_DN)
referral.create(properties=properties)

# Step 10 Check that the server detected the referral on both parent and child suffixes
time.sleep(REFERRAL_CHECK + 1)
assert topology_st.standalone.ds_error_log.match('.*slapd_daemon - New referral entries are detected under %s.*' % PARENT_SUFFIX)
assert topology_st.standalone.ds_error_log.match('.*slapd_daemon - New referral entries are detected under %s.*' % CHILD_SUFFIX)
assert not topology_st.standalone.ds_error_log.match('.*slapd_daemon - No more referral entry under %s' % CHILD_SUFFIX)

# Step 11 Delete the referral entry
referral.delete()

# Step 12 Check that the server detected the deletion of the referral on both parent and child suffixes
time.sleep(REFERRAL_CHECK + 1)
assert topology_st.standalone.ds_error_log.match('.*slapd_daemon - No more referral entry under %s' % PARENT_SUFFIX)
assert topology_st.standalone.ds_error_log.match('.*slapd_daemon - No more referral entry under %s' % CHILD_SUFFIX)

# Check that if we create a referral at child level and parent level
# - referral is detected at parent backend
# - referral is detected at child backend

# Step 13 Remove error log file
topology_st.standalone.stop()
lpath = topology_st.standalone.ds_error_log._get_log_path()
os.unlink(lpath)
topology_st.standalone.start()

# Step 14 Create a referral entry on parent suffix
# Create a referral entry on child suffix
REFERRAL_DN = "cn=my_ref,%s" % PARENT_SUFFIX
properties = ({'cn': 'my_ref',
'uid': 'my_ref',
'sn': 'my_ref',
'uidNumber': '1000',
'gidNumber': '2000',
'homeDirectory': '/home/testuser',
'description': 'referral entry',
'objectclass': "top referral extensibleObject".split(),
'ref': 'ref: ldap://remote/%s' % REFERRAL_DN})
referral = UserAccount(inst, REFERRAL_DN)
referral.create(properties=properties)
REFERRAL_DN = "cn=my_ref,%s" % CHILD_SUFFIX
properties = ({'cn': 'my_ref',
'uid': 'my_ref',
'sn': 'my_ref',
'uidNumber': '1000',
'gidNumber': '2000',
'homeDirectory': '/home/testuser',
'description': 'referral entry',
'objectclass': "top referral extensibleObject".split(),
'ref': 'ref: ldap://remote/%s' % REFERRAL_DN})
referral = UserAccount(inst, REFERRAL_DN)
referral.create(properties=properties)

# Step 15 Check that the server detected the referral on both parent and child suffixes
time.sleep(REFERRAL_CHECK + 1)
assert topology_st.standalone.ds_error_log.match('.*slapd_daemon - New referral entries are detected under %s.*' % PARENT_SUFFIX)
assert topology_st.standalone.ds_error_log.match('.*slapd_daemon - New referral entries are detected under %s.*' % CHILD_SUFFIX)
assert not topology_st.standalone.ds_error_log.match('.*slapd_daemon - No more referral entry under %s' % CHILD_SUFFIX)

# Step 16 Delete the child referral entry
REFERRAL_DN = "cn=my_ref,%s" % CHILD_SUFFIX
referral = UserAccount(inst, REFERRAL_DN)
referral.delete()

# Step 17 Check that the server detected the deletion of the referral on child suffix but not on parent suffix
time.sleep(REFERRAL_CHECK + 1)
assert topology_st.standalone.ds_error_log.match('.*slapd_daemon - No more referral entry under %s' % CHILD_SUFFIX)
assert not topology_st.standalone.ds_error_log.match('.*slapd_daemon - No more referral entry under %s' % PARENT_SUFFIX)

# Step 18 Delete the parent referral entry
REFERRAL_DN = "cn=my_ref,%s" % PARENT_SUFFIX
referral = UserAccount(inst, REFERRAL_DN)
referral.delete()

# Step 19 Check that the server detected the deletion of the referral parent suffix
time.sleep(REFERRAL_CHECK + 1)
assert topology_st.standalone.ds_error_log.match('.*slapd_daemon - No more referral entry under %s' % PARENT_SUFFIX)

def fin():
log.info('Deleting referral')
try:
REFERRAL_DN = "cn=my_ref,%s" % PARENT_SUFFIX
referral = UserAccount(inst, REFERRAL_DN)
referral.delete()
REFERRAL_DN = "cn=my_ref,%s" % CHILD_SUFFIX
referral = UserAccount(inst, REFERRAL_DN)
referral.delete()
except:
pass

request.addfinalizer(fin)

if __name__ == '__main__':
# Run isolated
Expand Down
Loading