From fbb0f806af6388fff56329aaba0ac6fd1ae18e41 Mon Sep 17 00:00:00 2001 From: Simon Pichugin Date: Sep 20 2017 10:03:15 +0000 Subject: Issue 49381 - Refactor numerous suite docstrings Description: We need to have properly formatted and detailed docstrings in all existing test suites. Suites that were changed in this commit: config, autotuning, range_search, paged_results, psearch, sasl plain. Also, fix constants in sasl plain suite and remove :feature: from create_test.py tool, it's not mandatory anymore. https://pagure.io/389-ds-base/issue/49381 Reviewed by: amsharma, vashirov (Thanks!) --- diff --git a/dirsrvtests/create_test.py b/dirsrvtests/create_test.py index da336fd..4902f7b 100755 --- a/dirsrvtests/create_test.py +++ b/dirsrvtests/create_test.py @@ -264,9 +264,8 @@ if len(sys.argv) > 0: TEST.write('\ndef test_ticket{}(topo):\n'.format(ticket)) else: TEST.write('\ndef test_something(topo):\n') - TEST.write(' """Write one-line test case purpose (name) here\n\n') + TEST.write(' """Specify a test case purpose or name here\n\n') TEST.write(' :id: {}\n'.format(tc_id)) - TEST.write(' :feature: Fill in feature name here\n') TEST.write(' :setup: Fill in set up configuration here\n') TEST.write(' :steps:\n') TEST.write(' 1. Fill in test case steps here\n') diff --git a/dirsrvtests/tests/suites/config/autotuning_test.py b/dirsrvtests/tests/suites/config/autotuning_test.py index b099f81..012db5e 100644 --- a/dirsrvtests/tests/suites/config/autotuning_test.py +++ b/dirsrvtests/tests/suites/config/autotuning_test.py @@ -24,13 +24,14 @@ log = logging.getLogger(__name__) def test_threads_basic(topo): """Check that a number of threads are able to be autotuned - :ID: 371fb9c4-9607-4a4b-a4a2-6f00809d6257 - :feature: Autotuning + :id: 371fb9c4-9607-4a4b-a4a2-6f00809d6257 :setup: Standalone instance - :steps: 1. Set nsslapd-threadnumber to -1 - 2. Get the number of CPUs on the system and match it with the value from docs - 3. Check that nsslapd-threadnumber is equal to the documented expected value - :expectedresults: nsslapd-threadnumber is equal to the documented expected value + :steps: + 1. Set nsslapd-threadnumber to -1 + 2. Check that number of threads is positive + :expectedresults: + 1. nsslapd-threadnumber should be successfully set + 2. nsslapd-threadnumber is positive """ log.info("Set nsslapd-threadnumber: -1 to enable autotuning") @@ -44,11 +45,12 @@ def test_threads_basic(topo): def test_threads_invalid_value(topo, invalid_value): """Check nsslapd-threadnumber for an invalid values - :ID: 1979eddf-8222-4c9d-809d-269c26de636e - :feature: Autotuning + :id: 1979eddf-8222-4c9d-809d-269c26de636e :setup: Standalone instance - :steps: 1. Set nsslapd-threadnumber to -2, 0, 513, invalid_str - :expectedresults: The operation should fail + :steps: + 1. Set nsslapd-threadnumber to -2, 0, invalid_str + :expectedresults: + 1. The operation should fail """ log.info("Set nsslapd-threadnumber: {}. Operation should fail".format(invalid_value)) @@ -59,14 +61,18 @@ def test_threads_invalid_value(topo, invalid_value): def test_threads_back_from_manual_value(topo): """Check that thread autotuning works after manual tuning - :ID: 4b674016-e5ca-426b-a9c0-a94745a7dd25 - :feature: Autotuning + :id: 4b674016-e5ca-426b-a9c0-a94745a7dd25 :setup: Standalone instance - :steps: 1. Set nsslapd-threadnumber to -1 and save the autotuned value - 2. Decrease nsslapd-threadnumber by 2 - 3. Set nsslapd-threadnumber to -1 - 4. Check that nsslapd-threadnumber is back to autotuned value - :expectedresults: nsslapd-threadnumber is set back to the autotuned value + :steps: + 1. Set nsslapd-threadnumber to -1 and save the autotuned value + 2. Decrease nsslapd-threadnumber by 2 + 3. Set nsslapd-threadnumber to -1 + 4. Check that nsslapd-threadnumber is back to autotuned value + :expectedresults: + 1. nsslapd-threadnumber should be successfully set + 2. nsslapd-threadnumber should be successfully decreased + 3. nsslapd-threadnumber should be successfully set + 4. nsslapd-threadnumber is set back to the autotuned value """ log.info("Set nsslapd-threadnumber: -1 to enable autotuning and save the new value") @@ -90,21 +96,24 @@ def test_threads_back_from_manual_value(topo): def test_cache_autosize_non_zero(topo, autosize, autosize_split): """Check that autosizing works works properly in different combinations - :ID: 83fa099c-a6c9-457a-82db-0982b67e8598 - :feature: Autotuning + :id: 83fa099c-a6c9-457a-82db-0982b67e8598 :setup: Standalone instance - :steps: 1. Set in the cn=config,cn=ldbm database,cn=plugins,cn=config: - nsslapd-cache-autosize, nsslapd-cache-autosize-split to the next value pairs: - ('', ''), ('', '0'), ('10', '40'), ('', '40'), - ('10', ''), ('10', '40'), ('10', '0') - '' - for deleting the value (set to default) - 2. Try to modify nsslapd-dbcachesize and nsslapd-cachememsize to - some real value, it should be rejected - 2. Restart the instance - 3. Check nsslapd-dbcachesize and nsslapd-cachememsize - :expectedresults: Modify operation was rejected, - nsslapd-dbcachesize and nsslapd-cachememsize were set to - value in the expected range between 512KB and max int on the system + :steps: + 1. Set in the cn=config,cn=ldbm database,cn=plugins,cn=config: + nsslapd-cache-autosize, nsslapd-cache-autosize-split to the next value pairs: + ('', ''), ('', '0'), ('10', '40'), ('', '40'), + ('10', ''), ('10', '40'), ('10', '0') + '' - for deleting the value (set to default) + 2. Try to modify nsslapd-dbcachesize and nsslapd-cachememsize to + some real value, it should be rejected + 3. Restart the instance + 4. Check nsslapd-dbcachesize and nsslapd-cachememsize + :expectedresults: + 1. nsslapd-cache-autosize, nsslapd-cache-autosize-split are successfully set + 2. Modify operation should be rejected + 3. The instance should be successfully restarted + 4. nsslapd-dbcachesize and nsslapd-cachememsize should set + to value greater than 512KB """ config_ldbm = DSLdapObject(topo.standalone, DN_CONFIG_LDBM) @@ -174,21 +183,26 @@ def test_cache_autosize_non_zero(topo, autosize, autosize_split): def test_cache_autosize_basic_sane(topo, autosize_split): """Check that autotuning cachesizes works properly with different values - :ID: 9dc363ef-f551-446d-8b83-8ac45dabb8df - :feature: Autotuning + :id: 9dc363ef-f551-446d-8b83-8ac45dabb8df :setup: Standalone instance - :steps: 1. Set in the cn=config,cn=ldbm database,cn=plugins,cn=config: - nsslapd-cache-autosize, nsslapd-cache-autosize-split to the next value pairs: - ('0', '0'), ('0', ''), ('0', '40') - '' - for deleting the value (set to default) - 2. Set in the cn=config,cn=ldbm database,cn=plugins,cn=config: - nsslapd-dbcachesize: 0 and some same value - 3. Set in the cn=UserRoot,cn=ldbm database,cn=plugins,cn=config: - nsslapd-cachememsize: 0 and some same value - 4. Restart the instance - 5. Check nsslapd-dbcachesize and nsslapd-cachememsize - :expectedresults: nsslapd-dbcachesize and nsslapd-cachememsize were set to - value in the expected range between 512KB and max int on the system + :steps: + 1. Set in the cn=config,cn=ldbm database,cn=plugins,cn=config: + nsslapd-cache-autosize, nsslapd-cache-autosize-split to the next value pairs: + ('0', '0'), ('0', ''), ('0', '40') + '' - for deleting the value (set to default) + 2. Set in the cn=config,cn=ldbm database,cn=plugins,cn=config: + nsslapd-dbcachesize: 0 and some same value + 3. Set in the cn=UserRoot,cn=ldbm database,cn=plugins,cn=config: + nsslapd-cachememsize: 0 and some same value + 4. Restart the instance + 5. Check nsslapd-dbcachesize and nsslapd-cachememsize + :expectedresults: + 1. nsslapd-cache-autosize, nsslapd-cache-autosize-split are successfully set + 2. nsslapd-dbcachesize are successfully set + 3. nsslapd-cachememsize are successfully set + 4. The instance should be successfully restarted + 5. nsslapd-dbcachesize and nsslapd-cachememsize should set + to value greater than 512KB """ config_ldbm = DSLdapObject(topo.standalone, DN_CONFIG_LDBM) @@ -246,15 +260,18 @@ def test_cache_autosize_basic_sane(topo, autosize_split): def test_cache_autosize_invalid_values(topo, invalid_value): """Check that we can't set invalid values to autosize attributes - :ID: 2f0d01b5-ca91-4dc2-97bc-ad0ac8d08633 - :feature: Autotuning + :id: 2f0d01b5-ca91-4dc2-97bc-ad0ac8d08633 :setup: Standalone instance - :steps: 1. Stop the instance - 2. Set in the cn=config,cn=ldbm database,cn=plugins,cn=config: - nsslapd-cache-autosize and nsslapd-cache-autosize-split - to invalid values like (-2, 102, invalid_str) - 3. Try to start the instance - :expectedresults: Start dirsrv operation should fail + :steps: + 1. Stop the instance + 2. Set in the cn=config,cn=ldbm database,cn=plugins,cn=config: + nsslapd-cache-autosize and nsslapd-cache-autosize-split + to invalid values like (-2, 102, invalid_str) + 3. Try to start the instance + :expectedresults: + 1. The instance should stop successfully + 2. nsslapd-cache-autosize, nsslapd-cache-autosize-split are successfully set + 3. Starting the instance should fail """ config_ldbm = DSLdapObject(topo.standalone, DN_CONFIG_LDBM) diff --git a/dirsrvtests/tests/suites/config/config_test.py b/dirsrvtests/tests/suites/config/config_test.py index 78a1724..6ed2a2f 100644 --- a/dirsrvtests/tests/suites/config/config_test.py +++ b/dirsrvtests/tests/suites/config/config_test.py @@ -65,17 +65,21 @@ def test_user(topology_m2): def test_maxbersize_repl(topology_m2, test_user, big_file): """maxbersize is ignored in the replicated operations. - :ID: ad57de60-7d56-4323-bbca-5556e5cdb126 - :feature: Config + :id: ad57de60-7d56-4323-bbca-5556e5cdb126 :setup: MMR with two masters, test user, - 1 MiB big value for attribute - :steps: 1. Set 20KiB small maxbersize on master2 - 2. Add big value to master2 - 3. Add big value to master1 - :expectedresults: Adding the big value to master2 is failed, - adding the big value to master1 is succeed, - the big value is successfully replicated to master2 + 1 MiB big value for any attribute + :steps: + 1. Set maxbersize attribute to a small value (20KiB) on master2 + 2. Add the big value to master2 + 3. Add the big value to master1 + 4. Check if the big value was successfully replicated to master2 + :expectedresults: + 1. maxbersize should be successfully set + 2. Adding the big value to master2 failed + 3. Adding the big value to master1 succeed + 4. The big value is successfully replicated to master2 """ + log.info("Set nsslapd-maxbersize: 20K to master2") try: topology_m2.ms["master2"].modify_s("cn=config", [(ldap.MOD_REPLACE, @@ -138,16 +142,20 @@ def test_maxbersize_repl(topology_m2, test_user, big_file): def test_config_listen_backport_size(topology_m2): """Check that nsslapd-listen-backlog-size acted as expected - :ID: a4385d58-a6ab-491e-a604-6df0e8ed91cd - :feature: Config - :setup: An instance - :steps: 1. Search for nsslapd-listen-backlog-size - 2. Set nsslapd-listen-backlog-size to a valid value - Try positive and negative. - 3. Set nsslapd-listen-backlog-size to an invalid value - 4. Set nsslapd-listen-backlog-size back to a default value - :expectedresults: Search and the valid modification should be a success - Modification with an invalid value should throw an error + :id: a4385d58-a6ab-491e-a604-6df0e8ed91cd + :setup: MMR with two masters + :steps: + 1. Search for nsslapd-listen-backlog-size + 2. Set nsslapd-listen-backlog-size to a positive value + 3. Set nsslapd-listen-backlog-size to a negative value + 4. Set nsslapd-listen-backlog-size to an invalid value + 5. Set nsslapd-listen-backlog-size back to a default value + :expectedresults: + 1. Search should be successful + 2. nsslapd-listen-backlog-size should be successfully set + 3. nsslapd-listen-backlog-size should be successfully set + 4. Modification with an invalid value should throw an error + 5. nsslapd-listen-backlog-size should be successfully set """ try: @@ -196,16 +204,20 @@ def test_config_deadlock_policy(topology_m2): """Check that nsslapd-db-deadlock-policy acted as expected :ID: a24e25fd-bc15-47fa-b018-372f6a2ec59c - :feature: Config - :setup: An instance - :steps: 1. Search for nsslapd-db-deadlock-policy and check if - it contains a default value - 2. Set nsslapd-db-deadlock-policy to a valid value - Try positive and negative. - 3. Set nsslapd-db-deadlock-policy to an invalid value - 4. Set nsslapd-db-deadlock-policy back to a default value - :expectedresults: Search and the valid modification should be a success - Modification with invalid values should throw an error + :setup: MMR with two masters + :steps: + 1. Search for nsslapd-db-deadlock-policy and check if + it contains a default value + 2. Set nsslapd-db-deadlock-policy to a positive value + 3. Set nsslapd-db-deadlock-policy to a negative value + 4. Set nsslapd-db-deadlock-policy to an invalid value + 5. Set nsslapd-db-deadlock-policy back to a default value + :expectedresults: + 1. Search should be a successful and should contain a default value + 2. nsslapd-db-deadlock-policy should be successfully set + 3. nsslapd-db-deadlock-policy should be successfully set + 4. Modification with an invalid value should throw an error + 5. nsslapd-db-deadlock-policy should be successfully set """ LDBM_DN = 'cn=config,cn=ldbm database,cn=plugins,cn=config' diff --git a/dirsrvtests/tests/suites/memory_leaks/range_search_test.py b/dirsrvtests/tests/suites/memory_leaks/range_search_test.py index 15be3c6..93020d3 100644 --- a/dirsrvtests/tests/suites/memory_leaks/range_search_test.py +++ b/dirsrvtests/tests/suites/memory_leaks/range_search_test.py @@ -53,9 +53,21 @@ def setup(topology_st, request): def test_range_search(topology_st, setup): - """Add a 100 entries, and run a range search. - When we encounter an error we still need to - disable valgrind before exiting + """Add 100 entries, and run a range search. When we encounter an error + we still need to disable valgrind before exiting + + :id: aadccf78-a2a8-48cc-8769-4764c7966189 + :setup: Standalone instance, Retro changelog file, + Enabled Valgrind if the system doesn't have asan + :steps: + 1. Add 100 test entries + 2. Issue a range search with a changenumber filter + 3. If the system doesn't have asan, get the valgrind results file, + stop the server, and check for the leak + :expectedresults: + 1. 100 test entries should be added + 2. Search should be successful + 3. There should be no leak """ log.info('Running test_range_search...') @@ -83,7 +95,6 @@ def test_range_search(topology_st, setup): log.fatal('test_range_search: Failed to search retro changelog(%s), error: %s' % (RETROCL_SUFFIX, e.message('desc'))) success = False - if success and not topology_st.standalone.has_asan(): # Get the results file, stop the server, and check for the leak results_file = valgrind_get_results_file(topology_st.standalone) diff --git a/dirsrvtests/tests/suites/paged_results/paged_results_test.py b/dirsrvtests/tests/suites/paged_results/paged_results_test.py index 6a8df4d..ae2627b 100644 --- a/dirsrvtests/tests/suites/paged_results/paged_results_test.py +++ b/dirsrvtests/tests/suites/paged_results/paged_results_test.py @@ -251,10 +251,13 @@ def test_search_success(topology_st, test_user, page_size, users_num): :id: ddd15b70-64f1-4a85-a793-b24761e50354 :feature: Simple paged results :setup: Standalone instance, test user for binding, - variated number of users for the search base - :steps: 1. Bind as test user - 2. Search through added users with a simple paged control - :expectedresults: All users should be found + varying number of users for the search base + :steps: + 1. Bind as test user + 2. Search through added users with a simple paged control + :expectedresults: + 1. Bind should be successful + 2. All users should be found """ users_list = add_users(topology_st, users_num, DEFAULT_SUFFIX) @@ -296,14 +299,17 @@ def test_search_limits_fail(topology_st, test_user, page_size, users_num, exceeded. :id: e3067107-bd6d-493d-9989-3e641a9337b0 - :feature: Simple paged results :setup: Standalone instance, test user for binding, - variated number of users for the search base - :steps: 1. Bind as test user - 2. Set limit attribute to the value that will cause - an expected exception - 3. Search through added users with a simple paged control - :expectedresults: Should fail with appropriate exception + varying number of users for the search base + :steps: + 1. Bind as test user + 2. Set limit attribute to the value that will cause + an expected exception + 3. Search through added users with a simple paged control + :expectedresults: + 1. Bind should be successful + 2. Operation should be successful + 3. Should fail with appropriate exception """ users_list = add_users(topology_st, users_num, DEFAULT_SUFFIX) @@ -379,13 +385,15 @@ def test_search_sort_success(topology_st, test_user): it should without errors. :id: 17d8b150-ed43-41e1-b80f-ee9b4ce45155 - :feature: Simple paged results :setup: Standalone instance, test user for binding, - variated number of users for the search base - :steps: 1. Bind as test user - 2. Search through added users with a simple paged control - and a server side sort control - :expectedresults: All users should be found and sorted + varying number of users for the search base + :steps: + 1. Bind as test user + 2. Search through added users with a simple paged control + and a server side sort control + :expectedresults: + 1. Bind should be successful + 2. All users should be found and sorted """ users_num = 50 @@ -423,14 +431,17 @@ def test_search_abandon(topology_st, test_user): can be abandon :id: 0008538b-7585-4356-839f-268828066978 - :feature: Simple paged results :setup: Standalone instance, test user for binding, - variated number of users for the search base - :steps: 1. Bind as test user - 2. Search through added users with a simple paged control - 3. Abandon the search - :expectedresults: It will throw an ldap.TIMEOUT exception, while trying - to get the rest of the search results + varying number of users for the search base + :steps: + 1. Bind as test user + 2. Search through added users with a simple paged control + 3. Abandon the search + :expectedresults: + 1. Bind should be successful + 2. Search should be started successfully + 3. It should throw an ldap.TIMEOUT exception + while trying to get the rest of the search results """ users_num = 10 @@ -471,15 +482,19 @@ def test_search_with_timelimit(topology_st, test_user): for a time more than the timelimit. :id: 6cd7234b-136c-419f-bf3e-43aa73592cff - :feature: Simple paged results :setup: Standalone instance, test user for binding, - variated number of users for the search base - :steps: 1. Bind as test user - 2. Search through added users with a simple paged control - and timelimit set to 5 - 3. When the returned cookie is empty, wait 10 seconds - 4. Perform steps 2 and 3 three times in a row - :expectedresults: No error happens + varying number of users for the search base + :steps: + 1. Bind as test user + 2. Search through added users with a simple paged control + and timelimit set to 5 + 3. When the returned cookie is empty, wait 10 seconds + 4. Perform steps 2 and 3 three times in a row + :expectedresults: + 1. Bind should be successful + 2. No error should happen + 3. 10 seconds should pass + 4. No error should happen """ users_num = 100 @@ -549,18 +564,25 @@ def test_search_dns_ip_aci(topology_st, test_user, aci_subject): to completion on the suffix with DNS or IP based ACI :id: bbfddc46-a8c8-49ae-8c90-7265d05b22a9 - :feature: Simple paged results :setup: Standalone instance, test user for binding, - variated number of users for the search base - :steps: 1. Back up and remove all previous ACI from suffix - 2. Add an anonymous ACI for DNS check - 3. Bind as test user - 4. Search through added users with a simple paged control - 5. Perform steps 4 three times in a row - 6. Return ACI to the initial state - 7. Go through all steps onece again, but use IP subjectdn - insted of DNS - :expectedresults: No error happens, all users should be found and sorted + varying number of users for the search base + :steps: + 1. Back up and remove all previous ACI from suffix + 2. Add an anonymous ACI for DNS check + 3. Bind as test user + 4. Search through added users with a simple paged control + 5. Perform steps 4 three times in a row + 6. Return ACI to the initial state + 7. Go through all steps once again, but use IP subject dn + instead of DNS + :expectedresults: + 1. Operation should be successful + 2. Anonymous ACI should be successfully added + 3. Bind should be successful + 4. No error happens, all users should be found and sorted + 5. Results should remain the same + 6. ACI should be successfully returned + 7. Results should be the same with ACI with IP subject dn """ users_num = 100 @@ -621,14 +643,18 @@ def test_search_multiple_paging(topology_st, test_user): on a single connection without a complition, it wouldn't fail. :id: 628b29a6-2d47-4116-a88d-00b87405ef7f - :feature: Simple paged results :setup: Standalone instance, test user for binding, - variated number of users for the search base - :steps: 1. Bind as test user - 2. Initiate the search with a simple paged control - 3. Acquire the returned cookie only one time - 4. Perform steps 2 and 3 three times in a row - :expectedresults: No error happens + varying number of users for the search base + :steps: + 1. Bind as test user + 2. Initiate the search with a simple paged control + 3. Acquire the returned cookie only one time + 4. Perform steps 2 and 3 three times in a row + :expectedresults: + 1. Bind should be successful + 2. Search should be successfully initiated + 3. Cookie should be successfully acquired + 4. No error happens """ users_num = 100 @@ -679,14 +705,18 @@ def test_search_invalid_cookie(topology_st, test_user, invalid_cookie): a TypeError exception :id: 107be12d-4fe4-47fe-ae86-f3e340a56f42 - :feature: Simple paged results :setup: Standalone instance, test user for binding, - variated number of users for the search base - :steps: 1. Bind as test user - 2. Initiate the search with a simple paged control - 3. Put an invalid cookie (-1, 1000) to the control - 4. Continue the search - :expectedresults: It will throw an TypeError exception + varying number of users for the search base + :steps: + 1. Bind as test user + 2. Initiate the search with a simple paged control + 3. Put an invalid cookie (-1, 1000) to the control + 4. Continue the search + :expectedresults: + 1. Bind should be successful + 2. Search should be successfully initiated + 3. Cookie should be added + 4. It should throw a TypeError exception """ users_num = 100 @@ -730,13 +760,15 @@ def test_search_abandon_with_zero_size(topology_st, test_user): can be abandon using page_size = 0 :id: d2fd9a10-84e1-4b69-a8a7-36ca1427c171 - :feature: Simple paged results :setup: Standalone instance, test user for binding, - variated number of users for the search base - :steps: 1. Bind as test user - 2. Search through added users with a simple paged control - and page_size = 0 - :expectedresults: No cookie should be returned at all + varying number of users for the search base + :steps: + 1. Bind as test user + 2. Search through added users with a simple paged control + and page_size = 0 + :expectedresults: + 1. Bind should be successful + 2. No cookie should be returned at all """ users_num = 10 @@ -777,14 +809,17 @@ def test_search_pagedsizelimit_success(topology_st, test_user): valid value set to nsslapd-pagedsizelimit. :id: 88193f10-f6f0-42f5-ae9c-ff34b8f9ee8c - :feature: Simple paged results :setup: Standalone instance, test user for binding, 10 users for the search base - :steps: 1. Set nsslapd-pagedsizelimit: 20 - 2. Bind as test user - 3. Search through added users with a simple paged control - using page_size = 10 - :expectedresults: All users should be found + :steps: + 1. Set nsslapd-pagedsizelimit: 20 + 2. Bind as test user + 3. Search through added users with a simple paged control + using page_size = 10 + :expectedresults: + 1. nsslapd-pagedsizelimit should be successfully set + 2. Bind should be successful + 3. All users should be found """ users_num = 10 @@ -827,24 +862,32 @@ def test_search_nspagedsizelimit(topology_st, test_user, the simple paged results control. :id: b08c6ad2-ba28-447a-9f04-5377c3661d0d - :feature: Simple paged results :setup: Standalone instance, test user for binding, 10 users for the search base - :steps: 1. Set nsslapd-pagedsizelimit: 5 - 2. Set nsPagedSizeLimit: 15 - 3. Bind as test user - 4. Search through added users with a simple paged control - using page_size = 10 - 5. Bind as Directory Manager - 6. Restore all values - 7. Set nsslapd-pagedsizelimit: 15 - 8. Set nsPagedSizeLimit: 5 - 9. Bind as test user - 10. Search through added users with a simple paged control - using page_size = 10 - :expectedresults: After the steps 1-4, it should PASS. - After the steps 7-10, it should throw - SIZELIMIT_EXCEEDED exception + :steps: + 1. Set nsslapd-pagedsizelimit: 5 + 2. Set nsPagedSizeLimit: 15 + 3. Bind as test user + 4. Search through added users with a simple paged control + using page_size = 10 + 5. Bind as Directory Manager + 6. Restore all values + 7. Set nsslapd-pagedsizelimit: 15 + 8. Set nsPagedSizeLimit: 5 + 9. Bind as test user + 10. Search through added users with a simple paged control + using page_size = 10 + :expectedresults: + 1. nsslapd-pagedsizelimit should be successfully set + 2. nsPagedSizeLimit should be successfully set + 3. Bind should be successful + 4. No error happens, all users should be found + 5. Bind should be successful + 6. All values should be restored + 7. nsslapd-pagedsizelimit should be successfully set + 8. nsPagedSizeLimit should be successfully set + 9. Bind should be successful + 10. It should throw SIZELIMIT_EXCEEDED exception """ users_num = 10 @@ -895,24 +938,33 @@ def test_search_paged_limits(topology_st, test_user, conf_attr_values, expected_ search abilities. :id: e0f8b916-7276-4bd3-9e73-8696a4468811 - :feature: Simple paged results :setup: Standalone instance, test user for binding, 10 users for the search base - :steps: 1. Set nsslapd-sizelimit and nsslapd-pagedsizelimit to 5000 - 2. Set nsslapd-idlistscanlimit: 120 - 3. Set nsslapd-lookthroughlimit: 122 - 4. Bind as test user - 5. Search through added users with a simple paged control - using page_size = 10 - 6. Bind as Directory Manager - 7. Set nsslapd-idlistscanlimit: 100 - 8. Set nsslapd-lookthroughlimit: 100 - 9. Bind as test user - 10. Search through added users with a simple paged control - using page_size = 10 - :expectedresults: After the steps 1-4, it should PASS. - After the steps 7-10, it should throw - ADMINLIMIT_EXCEEDED exception + :steps: + 1. Set nsslapd-sizelimit and nsslapd-pagedsizelimit to 5000 + 2. Set nsslapd-idlistscanlimit: 120 + 3. Set nsslapd-lookthroughlimit: 122 + 4. Bind as test user + 5. Search through added users with a simple paged control + using page_size = 10 + 6. Bind as Directory Manager + 7. Set nsslapd-idlistscanlimit: 100 + 8. Set nsslapd-lookthroughlimit: 100 + 9. Bind as test user + 10. Search through added users with a simple paged control + using page_size = 10 + :expectedresults: + 1. nsslapd-sizelimit and nsslapd-pagedsizelimit + should be successfully set + 2. nsslapd-idlistscanlimit should be successfully set + 3. nsslapd-lookthroughlimit should be successfully set + 4. Bind should be successful + 5. No error happens, all users should be found + 6. Bind should be successful + 7. nsslapd-idlistscanlimit should be successfully set + 8. nsslapd-lookthroughlimit should be successfully set + 9. Bind should be successful + 10. It should throw ADMINLIMIT_EXCEEDED exception """ users_num = 101 @@ -970,25 +1022,34 @@ def test_search_paged_user_limits(topology_st, test_user, conf_attr_values, expe while performing search with the simple paged results control. :id: 69e393e9-1ab8-4f4e-b4a1-06ca63dc7b1b - :feature: Simple paged results :setup: Standalone instance, test user for binding, 10 users for the search base - :steps: 1. Set nsslapd-idlistscanlimit: 1000 - 2. Set nsslapd-lookthroughlimit: 1000 - 3. Set nsPagedIDListScanLimit: 120 - 4. Set nsPagedLookthroughLimit: 122 - 5. Bind as test user - 6. Search through added users with a simple paged control - using page_size = 10 - 7. Bind as Directory Manager - 8. Set nsPagedIDListScanLimit: 100 - 9. Set nsPagedLookthroughLimit: 100 - 10. Bind as test user - 11. Search through added users with a simple paged control - using page_size = 10 - :expectedresults: After the steps 1-4, it should PASS. - After the steps 8-11, it should throw - ADMINLIMIT_EXCEEDED exception + :steps: + 1. Set nsslapd-idlistscanlimit: 1000 + 2. Set nsslapd-lookthroughlimit: 1000 + 3. Set nsPagedIDListScanLimit: 120 + 4. Set nsPagedLookthroughLimit: 122 + 5. Bind as test user + 6. Search through added users with a simple paged control + using page_size = 10 + 7. Bind as Directory Manager + 8. Set nsPagedIDListScanLimit: 100 + 9. Set nsPagedLookthroughLimit: 100 + 10. Bind as test user + 11. Search through added users with a simple paged control + using page_size = 10 + :expectedresults: + 1. nsslapd-idlistscanlimit should be successfully set + 2. nsslapd-lookthroughlimit should be successfully set + 3. nsPagedIDListScanLimit should be successfully set + 4. nsPagedLookthroughLimit should be successfully set + 5. Bind should be successful + 6. No error happens, all users should be found + 7. Bind should be successful + 8. nsPagedIDListScanLimit should be successfully set + 9. nsPagedLookthroughLimit should be successfully set + 10. Bind should be successful + 11. It should throw ADMINLIMIT_EXCEEDED exception """ users_num = 101 @@ -1043,13 +1104,14 @@ def test_ger_basic(topology_st, test_user): it should without errors. :id: 7b0bdfc7-a2f2-4c1a-bcab-f1eb8b330d45 - :feature: Simple paged results :setup: Standalone instance, test user for binding, - variated number of users for the search base - :steps: 1. Search through added users with a simple paged control - and get effective rights control - :expectedresults: All users should be found, every found entry should have - an 'attributeLevelRights' returned + varying number of users for the search base + :steps: + 1. Search through added users with a simple paged control + and get effective rights control + :expectedresults: + 1. All users should be found, every found entry should have + an 'attributeLevelRights' returned """ users_list = add_users(topology_st, 20, DEFAULT_SUFFIX) @@ -1081,18 +1143,21 @@ def test_multi_suffix_search(topology_st, test_user, new_suffixes): if there is no returned entry. :id: 9712345b-9e38-4df6-8794-05f12c457d39 - :feature: Simple paged results :setup: Standalone instance, test user for binding, two suffixes with backends, one is inserted into another, 10 users for the search base within each suffix - :steps: 1. Bind as test user - 2. Search through all 20 added users with a simple paged control - using page_size = 4 - 3. Wait some time logs to be updated - 3. Check access log - :expectedresults: All users should be found, the access log should contain - the pr_cookie for each page request and it should be equal 0, - except the last one should be equal -1 + :steps: + 1. Bind as test user + 2. Search through all 20 added users with a simple paged control + using page_size = 4 + 3. Wait some time for the logs to be updated + 4. Check access log + :expectedresults: + 1. Bind should be successful + 2. All users should be found + 3. Some time should pass + 4. The access log should contain the pr_cookie for each page request + and it should be equal 0, except the last one should be equal -1 """ search_flt = r'(uid=test*)' @@ -1139,17 +1204,18 @@ def test_maxsimplepaged_per_conn_success(topology_st, test_user, conf_attr_value """Verify that nsslapd-maxsimplepaged-per-conn acts according design :id: 192e2f25-04ee-4ff9-9340-d875dcbe8011 - :feature: Simple paged results :setup: Standalone instance, test user for binding, 20 users for the search base - :steps: 1. Set nsslapd-maxsimplepaged-per-conn in cn=config - to the next values: no value, -1, some positive - 2. Search through the added users with a simple paged control - using page size = 4 - :expectedresults: If no value or value = -1 - all users should be found, - default behaviour; - If the value is positive, the value is the max simple paged - results requests per connection. + :steps: + 1. Set nsslapd-maxsimplepaged-per-conn in cn=config + to the next values: no value, -1, some positive + 2. Search through the added users with a simple paged control + using page size = 4 + :expectedresults: + 1. nsslapd-maxsimplepaged-per-conn should be successfully set + 2. If no value or value = -1 - all users should be found, + default behaviour; If the value is positive, + the value is the max simple paged results requests per connection. """ users_list = add_users(topology_st, 20, DEFAULT_SUFFIX) @@ -1186,16 +1252,20 @@ def test_maxsimplepaged_per_conn_failure(topology_st, test_user, conf_attr_value """Verify that nsslapd-maxsimplepaged-per-conn acts according design :id: eb609e63-2829-4331-8439-a35f99694efa - :feature: Simple paged results :setup: Standalone instance, test user for binding, 20 users for the search base - :steps: 1. Set nsslapd-maxsimplepaged-per-conn = 0 in cn=config - 2. Search through the added users with a simple paged control - using page size = 4 - 3. Set nsslapd-maxsimplepaged-per-conn = 1 in cn=config - 4. Search through the added users with a simple paged control - using page size = 4 two times, but don't close the connections - :expectedresults: During the searches UNWILLING_TO_PERFORM should be throwned + :steps: + 1. Set nsslapd-maxsimplepaged-per-conn = 0 in cn=config + 2. Search through the added users with a simple paged control + using page size = 4 + 3. Set nsslapd-maxsimplepaged-per-conn = 1 in cn=config + 4. Search through the added users with a simple paged control + using page size = 4 two times, but don't close the connections + :expectedresults: + 1. nsslapd-maxsimplepaged-per-conn should be successfully set + 2. UNWILLING_TO_PERFORM should be thrown + 3. Bind should be successful + 4. UNWILLING_TO_PERFORM should be thrown """ users_list = add_users(topology_st, 20, DEFAULT_SUFFIX) diff --git a/dirsrvtests/tests/suites/psearch/psearch_test.py b/dirsrvtests/tests/suites/psearch/psearch_test.py index 4f53bb9..354f479 100644 --- a/dirsrvtests/tests/suites/psearch/psearch_test.py +++ b/dirsrvtests/tests/suites/psearch/psearch_test.py @@ -13,12 +13,15 @@ from lib389.idm.group import Groups import ldap from ldap.controls.psearch import PersistentSearchControl,EntryChangeNotificationControl + def _run_psearch(inst, msg_id): + """Run a search with EntryChangeNotificationControl""" + results = [] while True: try: _, data, _, _, _, _ = inst.result4(msgid=msg_id, all=0, timeout=1.0, add_ctrls=1, add_intermediates=1, - resp_ctrl_classes={EntryChangeNotificationControl.controlType:EntryChangeNotificationControl}) + resp_ctrl_classes={EntryChangeNotificationControl.controlType:EntryChangeNotificationControl}) # See if there are any entry changes for dn, entry, srv_ctrls in data: ecn_ctrls = filter(lambda c: c.controlType == EntryChangeNotificationControl.controlType, srv_ctrls) @@ -30,7 +33,24 @@ def _run_psearch(inst, msg_id): inst.log.info('No more results') return results + def test_psearch(topology_st): + """Check basic Persistent Search control functionality + + :id: 4b395ef4-c3ff-49d1-a680-b9fdffa633bd + :setup: Standalone instance + :steps: + 1. Run an extended search with a Persistent Search control + 2. Create a new group (could be any entry) + 3. Run an extended search with a Persistent Search control again + 4. Check that entry DN is in the result + :expectedresults: + 1. Operation should be successful + 2. Group should be successfully created + 3. Operation should be successful + 4. Entry DN should be in the result + """ + # Create the search control psc = PersistentSearchControl() # do a search extended with the control diff --git a/dirsrvtests/tests/suites/sasl/plain.py b/dirsrvtests/tests/suites/sasl/plain.py index 6bf39a8..a48e340 100644 --- a/dirsrvtests/tests/suites/sasl/plain.py +++ b/dirsrvtests/tests/suites/sasl/plain.py @@ -13,14 +13,49 @@ import ldap from lib389.topologies import topology_st # This pulls in logging I think from lib389.utils import * +from lib389._constants import DEFAULT_SUFFIX, DEFAULT_SECURE_PORT from lib389.sasl import PlainSASL from lib389.idm.services import ServiceAccounts -from lib389._constants import (SECUREPORT_STANDALONE1, DEFAULT_SUFFIX) log = logging.getLogger(__name__) def test_sasl_plain(topology_st): + """Check basic SASL functionality for PLAIN mechanism + + :id: 75ddc6fa-aa5a-4025-9c71-1abad20c91fc + :setup: Standalone instance + :steps: + 1. Stop the instance + 2. Clean up confdir from previous cert and key files + 3. Create RSA files: CA, key and cert + 4. Start the instance + 5. Create RSA entry + 6. Set nsslapd-secureport to 636 and nsslapd-security to 'on' + 7. Restart the instance + 8. Create a user + 9. Check we can bind + 10. Check that PLAIN is listed in supported mechs + 11. Set up Plain SASL credentials + 12. Try to open a connection without TLS + 13. Try to open a connection with TLS + 14. Try to open a connection with a wrong password + :expectedresults: + 1. The instance should stop + 2. Confdir should be clean + 3. RSA files should be created + 4. The instance should start + 5. RSA entry should be created + 6. nsslapd-secureport and nsslapd-security should be set successfully + 7. The instance should be restarted + 8. User should be created + 9. Bind should be successful + 10. PLAIN should be listed in supported mechs + 11. Plain SASL should be successfully set + 12. AUTH_UNKNOWN exception should be raised + 13. The connection should open + 14. INVALID_CREDENTIALS exception should be raised + """ standalone = topology_st.standalone @@ -40,7 +75,7 @@ def test_sasl_plain(topology_st): standalone.rsa.create() # Set the secure port and nsslapd-security # Could this fail with selinux? - standalone.config.set('nsslapd-secureport', '%s' % SECUREPORT_STANDALONE1) + standalone.config.set('nsslapd-secureport', str(DEFAULT_SECURE_PORT)) standalone.config.set('nsslapd-security', 'on') # Do we need to restart to allow starttls? standalone.restart()