This is an automated email from the git hooks/post-receive script.
spichugi pushed a change to branch master in repository 389-ds-base.
from f77e777 Issue 49158 - fix latest coverity issues new a51026f Issue 49156 - Clean up test suites dir structure and docstrings
The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference.
Summary of changes: dirsrvtests/create_test.py | 40 +++++- .../suites/attr_uniqueness_plugin/__init__.py | 0 .../tests/suites/automember_plugin/__init__.py | 0 .../tests/suites/chaining_plugin/__init__.py | 0 .../tests/suites/collation_plugin/__init__.py | 0 dirsrvtests/tests/suites/config/config_test.py | 44 +++++-- dirsrvtests/tests/suites/cos_plugin/__init__.py | 0 dirsrvtests/tests/suites/deref_plugin/__init__.py | 0 .../tests/suites/distrib_plugin/__init__.py | 0 dirsrvtests/tests/suites/dna_plugin/__init__.py | 0 .../tests/suites/dynamic-plugins/__init__.py | 0 .../__init__.py | 0 .../dynamic_plugins_test.py} | 0 .../plugin_tests.py | 0 .../stress_tests.py | 0 .../suites/filter/rfc3673_all_oper_attrs_test.py | 24 ++-- .../tests/suites/linkedattrs_plugin/__init__.py | 0 .../tests/suites/memberof_plugin/__init__.py | 0 dirsrvtests/tests/suites/mep_plugin/__init__.py | 0 .../suites/paged_results/paged_results_test.py | 136 ++++++++++----------- .../tests/suites/pam_passthru_plugin/__init__.py | 0 .../tests/suites/passthru_plugin/__init__.py | 0 .../suites/password/pwdPolicy_attribute_test.py | 20 ++- .../password/pwdPolicy_inherit_global_test.py | 24 ++-- .../suites/password/pwdPolicy_warning_test.py | 85 ++++++------- .../{acctpolicy_plugin => plugins}/__init__.py | 0 .../{acctpolicy_plugin => plugins}/accpol_test.py | 44 +++---- .../attr_uniqueness_test.py | 0 .../suites/{dna_plugin => plugins}/dna_test.py | 0 .../{memberof_plugin => plugins}/memberof_test.py | 0 .../rootdn_plugin_test.py | 0 .../tests/suites/posix_winsync_plugin/__init__.py | 0 .../tests/suites/referint_plugin/__init__.py | 0 .../tests/suites/replication/acceptance_test.py | 58 ++++----- .../tests/suites/replication/single_master_test.py | 32 ++--- .../tests/suites/replication/tombstone_test.py | 20 +-- .../tests/suites/replsync_plugin/__init__.py | 0 .../tests/suites/retrocl_plugin/__init__.py | 0 .../tests/suites/reverpwd_plugin/__init__.py | 0 dirsrvtests/tests/suites/roles_plugin/__init__.py | 0 dirsrvtests/tests/suites/rootdn_plugin/__init__.py | 0 .../tests/suites/schema_reload_plugin/__init__.py | 0 dirsrvtests/tests/suites/syntax_plugin/__init__.py | 0 dirsrvtests/tests/suites/usn_plugin/__init__.py | 0 dirsrvtests/tests/suites/views_plugin/__init__.py | 0 dirsrvtests/tests/suites/whoami_plugin/__init__.py | 0 46 files changed, 281 insertions(+), 246 deletions(-) delete mode 100644 dirsrvtests/tests/suites/attr_uniqueness_plugin/__init__.py delete mode 100644 dirsrvtests/tests/suites/automember_plugin/__init__.py delete mode 100644 dirsrvtests/tests/suites/chaining_plugin/__init__.py delete mode 100644 dirsrvtests/tests/suites/collation_plugin/__init__.py delete mode 100644 dirsrvtests/tests/suites/cos_plugin/__init__.py delete mode 100644 dirsrvtests/tests/suites/deref_plugin/__init__.py delete mode 100644 dirsrvtests/tests/suites/distrib_plugin/__init__.py delete mode 100644 dirsrvtests/tests/suites/dna_plugin/__init__.py delete mode 100644 dirsrvtests/tests/suites/dynamic-plugins/__init__.py rename dirsrvtests/tests/suites/{acct_usability_plugin => dynamic_plugins}/__init__.py (100%) rename dirsrvtests/tests/suites/{dynamic-plugins/test_dynamic_plugins.py => dynamic_plugins/dynamic_plugins_test.py} (100%) rename dirsrvtests/tests/suites/{dynamic-plugins => dynamic_plugins}/plugin_tests.py (100%) rename dirsrvtests/tests/suites/{dynamic-plugins => dynamic_plugins}/stress_tests.py (100%) delete mode 100644 dirsrvtests/tests/suites/linkedattrs_plugin/__init__.py delete mode 100644 dirsrvtests/tests/suites/memberof_plugin/__init__.py delete mode 100644 dirsrvtests/tests/suites/mep_plugin/__init__.py delete mode 100644 dirsrvtests/tests/suites/pam_passthru_plugin/__init__.py delete mode 100644 dirsrvtests/tests/suites/passthru_plugin/__init__.py rename dirsrvtests/tests/suites/{acctpolicy_plugin => plugins}/__init__.py (100%) rename dirsrvtests/tests/suites/{acctpolicy_plugin => plugins}/accpol_test.py (91%) rename dirsrvtests/tests/suites/{attr_uniqueness_plugin => plugins}/attr_uniqueness_test.py (100%) rename dirsrvtests/tests/suites/{dna_plugin => plugins}/dna_test.py (100%) rename dirsrvtests/tests/suites/{memberof_plugin => plugins}/memberof_test.py (100%) rename dirsrvtests/tests/suites/{rootdn_plugin => plugins}/rootdn_plugin_test.py (100%) delete mode 100644 dirsrvtests/tests/suites/posix_winsync_plugin/__init__.py delete mode 100644 dirsrvtests/tests/suites/referint_plugin/__init__.py delete mode 100644 dirsrvtests/tests/suites/replsync_plugin/__init__.py delete mode 100644 dirsrvtests/tests/suites/retrocl_plugin/__init__.py delete mode 100644 dirsrvtests/tests/suites/reverpwd_plugin/__init__.py delete mode 100644 dirsrvtests/tests/suites/roles_plugin/__init__.py delete mode 100644 dirsrvtests/tests/suites/rootdn_plugin/__init__.py delete mode 100644 dirsrvtests/tests/suites/schema_reload_plugin/__init__.py delete mode 100644 dirsrvtests/tests/suites/syntax_plugin/__init__.py delete mode 100644 dirsrvtests/tests/suites/usn_plugin/__init__.py delete mode 100644 dirsrvtests/tests/suites/views_plugin/__init__.py delete mode 100644 dirsrvtests/tests/suites/whoami_plugin/__init__.py
This is an automated email from the git hooks/post-receive script.
spichugi pushed a commit to branch master in repository 389-ds-base.
commit a51026ff7b022ce270d3c1fd040d5fd7d91b2ca4 Author: Simon Pichugin spichugi@redhat.com Date: Thu Mar 2 16:53:55 2017 +0100
Issue 49156 - Clean up test suites dir structure and docstrings
Description: We have a lot of plugin directories in dirsrvtests/tests/suites: - dynamic_plugins - [PluginName]_plugin - 27 directories While we are in the process of creating tickets for the porting sprint, it would be nice to have an organised structure. As discussed on the Engineering/QE Sync Up meeting we need to move all of them to 'plugins' dir.
Also, as a part of test suites cleanup, we should organise test plans in the docstrings and IDs to an each test case (can be generated with Python 'import uuid; uuid.uuid4()'). create_test.py script should be fixed too and it should check if the ID is unique throughout the tests.
https://pagure.io/389-ds-base/issue/49156
Reviewed by: wibrown, amsharma (Thanks!) --- dirsrvtests/create_test.py | 40 +++++- .../suites/attr_uniqueness_plugin/__init__.py | 0 .../tests/suites/automember_plugin/__init__.py | 0 .../tests/suites/chaining_plugin/__init__.py | 0 .../tests/suites/collation_plugin/__init__.py | 0 dirsrvtests/tests/suites/config/config_test.py | 44 +++++-- dirsrvtests/tests/suites/cos_plugin/__init__.py | 0 dirsrvtests/tests/suites/deref_plugin/__init__.py | 0 .../tests/suites/distrib_plugin/__init__.py | 0 dirsrvtests/tests/suites/dna_plugin/__init__.py | 0 .../tests/suites/dynamic-plugins/__init__.py | 0 .../__init__.py | 0 .../dynamic_plugins_test.py} | 0 .../plugin_tests.py | 0 .../stress_tests.py | 0 .../suites/filter/rfc3673_all_oper_attrs_test.py | 24 ++-- .../tests/suites/linkedattrs_plugin/__init__.py | 0 .../tests/suites/memberof_plugin/__init__.py | 0 dirsrvtests/tests/suites/mep_plugin/__init__.py | 0 .../suites/paged_results/paged_results_test.py | 136 ++++++++++----------- .../tests/suites/pam_passthru_plugin/__init__.py | 0 .../tests/suites/passthru_plugin/__init__.py | 0 .../suites/password/pwdPolicy_attribute_test.py | 20 ++- .../password/pwdPolicy_inherit_global_test.py | 24 ++-- .../suites/password/pwdPolicy_warning_test.py | 85 ++++++------- .../{acctpolicy_plugin => plugins}/__init__.py | 0 .../{acctpolicy_plugin => plugins}/accpol_test.py | 44 +++---- .../attr_uniqueness_test.py | 0 .../suites/{dna_plugin => plugins}/dna_test.py | 0 .../{memberof_plugin => plugins}/memberof_test.py | 0 .../rootdn_plugin_test.py | 0 .../tests/suites/posix_winsync_plugin/__init__.py | 0 .../tests/suites/referint_plugin/__init__.py | 0 .../tests/suites/replication/acceptance_test.py | 58 ++++----- .../tests/suites/replication/single_master_test.py | 32 ++--- .../tests/suites/replication/tombstone_test.py | 20 +-- .../tests/suites/replsync_plugin/__init__.py | 0 .../tests/suites/retrocl_plugin/__init__.py | 0 .../tests/suites/reverpwd_plugin/__init__.py | 0 dirsrvtests/tests/suites/roles_plugin/__init__.py | 0 dirsrvtests/tests/suites/rootdn_plugin/__init__.py | 0 .../tests/suites/schema_reload_plugin/__init__.py | 0 dirsrvtests/tests/suites/syntax_plugin/__init__.py | 0 dirsrvtests/tests/suites/usn_plugin/__init__.py | 0 dirsrvtests/tests/suites/views_plugin/__init__.py | 0 dirsrvtests/tests/suites/whoami_plugin/__init__.py | 0 46 files changed, 281 insertions(+), 246 deletions(-)
diff --git a/dirsrvtests/create_test.py b/dirsrvtests/create_test.py index d898397..0461ae0 100755 --- a/dirsrvtests/create_test.py +++ b/dirsrvtests/create_test.py @@ -9,7 +9,10 @@ # --- END COPYRIGHT BLOCK ---
import optparse +import os +import re import sys +import uuid from lib389 import topologies
"""This script generates a template test script that handles the @@ -113,6 +116,24 @@ def get_existing_topologies(inst, masters, hubs, consumers): return [False, my_topology]
+def check_id_uniqueness(id_value): + """Checks if ID is already present in other tests. + create_test.py script should exist in the directory + with a 'tests' dir. + """ + + tests_dir = os.path.join(os.getcwd(), 'tests') + + for root, dirs, files in os.walk(tests_dir): + for name in files: + with open(os.path.join(root, name), "r") as file: + for line in file: + if re.search(str(id_value), line): + return False + + return True + + desc = 'Script to generate an initial lib389 test script. ' + \ 'This generates the topology, test, final, and run-isolated functions.'
@@ -654,6 +675,9 @@ if len(sys.argv) > 0: TEST.write(', standalone' + str(idx)) TEST.write(')\n\n\n')
+ tc_id = '0' + while not check_id_uniqueness(tc_id): tc_id = uuid.uuid4() + # Write the test function if ticket: TEST.write('def test_ticket{}(topo):\n'.format(ticket)) @@ -664,11 +688,17 @@ if len(sys.argv) > 0: TEST.write(' """\n\n') else: TEST.write('def test_something(topo):\n') - TEST.write(' """Write a single test here...\n\n') - TEST.write(' Also, if you need any test suite initialization,\n') - TEST.write(' please, write additional fixture for that (including finalizer).\n' - ' Topology for suites are predefined in lib389/topologies.py.\n' - ' """\n\n') + TEST.write(' """Write one-line test case purpose (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: 1. Fill in test case steps here\n') + TEST.write(' 2. And indent them like this (RST format requirement)\n') + TEST.write(' :assert: Fill in the result that is expected\n') + TEST.write(' """\n\n') + TEST.write(' # If you need any test suite initialization,\n') + TEST.write(' # please, write additional fixture for that (including finalizer).\n' + ' # Topology for suites are predefined in lib389/topologies.py.\n\n')
TEST.write(' if DEBUGGING:\n') TEST.write(' # Add debugging steps(if any)...\n') diff --git a/dirsrvtests/tests/suites/attr_uniqueness_plugin/__init__.py b/dirsrvtests/tests/suites/attr_uniqueness_plugin/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/dirsrvtests/tests/suites/automember_plugin/__init__.py b/dirsrvtests/tests/suites/automember_plugin/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/dirsrvtests/tests/suites/chaining_plugin/__init__.py b/dirsrvtests/tests/suites/chaining_plugin/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/dirsrvtests/tests/suites/collation_plugin/__init__.py b/dirsrvtests/tests/suites/collation_plugin/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/dirsrvtests/tests/suites/config/config_test.py b/dirsrvtests/tests/suites/config/config_test.py index 361a23d..1c67fcf 100644 --- a/dirsrvtests/tests/suites/config/config_test.py +++ b/dirsrvtests/tests/suites/config/config_test.py @@ -63,16 +63,14 @@ def test_user(topology_m2): def test_maxbersize_repl(topology_m2, test_user, big_file): """maxbersize is ignored in the replicated operations.
- :Feature: Config - - :Setup: MMR with two masters, test user, + :ID: ad57de60-7d56-4323-bbca-5556e5cdb126 + :feature: Config + :setup: MMR with two masters, test user, 1 MiB big value for attribute - - :Steps: 1. Set 20KiB small maxbersize on master2 + :steps: 1. Set 20KiB small maxbersize on master2 2. Add big value to master2 3. Add big value to master1 - - :Assert: Adding the big value to master2 is failed, + :assert: Adding the big value to master2 is failed, adding the big value to master1 is succeed, the big value is successfully replicated to master2 """ @@ -136,9 +134,18 @@ def test_maxbersize_repl(topology_m2, test_user, big_file):
def test_config_listen_backport_size(topology_m2): - """We need to check that we can search on nsslapd-listen-backlog-size, - and change its value: to a psoitive number and a negative number. - Verify invalid value is rejected. + """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 + :assert: Search and the valid modification should be a success + Modification with an invalid value should throw an error """
try: @@ -184,8 +191,19 @@ def test_config_listen_backport_size(topology_m2):
def test_config_deadlock_policy(topology_m2): - """We need to check that nsslapd-db-deadlock-policy exists, that we can - change the value, and invalid values are rejected + """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 + :assert: Search and the valid modification should be a success + Modification with invalid values should throw an error """
LDBM_DN = 'cn=config,cn=ldbm database,cn=plugins,cn=config' @@ -196,7 +214,7 @@ def test_config_deadlock_policy(topology_m2): ['nsslapd-db-deadlock-policy']) val = entry[0].data['nsslapd-db-deadlock-policy'][0] assert val, 'Failed to get nsslapd-db-deadlock-policy from config' - assert val == default_val, 'The wrong derfualt value was present' + assert val == default_val, 'The wrong default value was present' except ldap.LDAPError as e: log.fatal('Failed to search config, error: ' + e.message('desc')) raise diff --git a/dirsrvtests/tests/suites/cos_plugin/__init__.py b/dirsrvtests/tests/suites/cos_plugin/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/dirsrvtests/tests/suites/deref_plugin/__init__.py b/dirsrvtests/tests/suites/deref_plugin/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/dirsrvtests/tests/suites/distrib_plugin/__init__.py b/dirsrvtests/tests/suites/distrib_plugin/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/dirsrvtests/tests/suites/dna_plugin/__init__.py b/dirsrvtests/tests/suites/dna_plugin/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/dirsrvtests/tests/suites/dynamic-plugins/__init__.py b/dirsrvtests/tests/suites/dynamic-plugins/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/dirsrvtests/tests/suites/acct_usability_plugin/__init__.py b/dirsrvtests/tests/suites/dynamic_plugins/__init__.py similarity index 100% rename from dirsrvtests/tests/suites/acct_usability_plugin/__init__.py rename to dirsrvtests/tests/suites/dynamic_plugins/__init__.py diff --git a/dirsrvtests/tests/suites/dynamic-plugins/test_dynamic_plugins.py b/dirsrvtests/tests/suites/dynamic_plugins/dynamic_plugins_test.py similarity index 100% rename from dirsrvtests/tests/suites/dynamic-plugins/test_dynamic_plugins.py rename to dirsrvtests/tests/suites/dynamic_plugins/dynamic_plugins_test.py diff --git a/dirsrvtests/tests/suites/dynamic-plugins/plugin_tests.py b/dirsrvtests/tests/suites/dynamic_plugins/plugin_tests.py similarity index 100% rename from dirsrvtests/tests/suites/dynamic-plugins/plugin_tests.py rename to dirsrvtests/tests/suites/dynamic_plugins/plugin_tests.py diff --git a/dirsrvtests/tests/suites/dynamic-plugins/stress_tests.py b/dirsrvtests/tests/suites/dynamic_plugins/stress_tests.py similarity index 100% rename from dirsrvtests/tests/suites/dynamic-plugins/stress_tests.py rename to dirsrvtests/tests/suites/dynamic_plugins/stress_tests.py diff --git a/dirsrvtests/tests/suites/filter/rfc3673_all_oper_attrs_test.py b/dirsrvtests/tests/suites/filter/rfc3673_all_oper_attrs_test.py index 3fc94d7..b9fcafc 100644 --- a/dirsrvtests/tests/suites/filter/rfc3673_all_oper_attrs_test.py +++ b/dirsrvtests/tests/suites/filter/rfc3673_all_oper_attrs_test.py @@ -96,13 +96,11 @@ def test_supported_features(topology_st): """Verify that OID 1.3.6.1.4.1.4203.1.5.1 is published in the supportedFeatures [RFC3674] attribute in the rootDSE.
- :Feature: Filter - - :Setup: Standalone instance - - :Steps: 1. Search for 'supportedFeatures' at rootDSE - - :Assert: Value 1.3.6.1.4.1.4203.1.5.1 is presented + :ID: 441b3f1f-a24b-4943-aa65-7edce460abbf + :feature: Filter + :setup: Standalone instance + :steps: 1. Search for 'supportedFeatures' at rootDSE + :assert: Value 1.3.6.1.4.1.4203.1.5.1 is presented """
entries = topology_st.standalone.search_s('', ldap.SCOPE_BASE, @@ -122,16 +120,14 @@ def test_search_basic(topology_st, test_user, user_aci, add_attr, by a Search Request [RFC2251] with '+' (ASCII 43) filter. Please see: https://tools.ietf.org/html/rfc3673
- :Feature: Filter - - :Setup: Standalone instance, test user for binding, + :ID: 14c66bc2-28e1-4f5f-893e-508e0f720f8c + :feature: Filter + :setup: Standalone instance, test user for binding, deny one attribute aci for that user - - :Steps: 1. Bind as regular user or Directory Manager + :steps: 1. Bind as regular user or Directory Manager 2. Search with '+' filter and with additionaly 'objectClass' and '*' attrs too - - :Assert: All expected values were returned, not more + :assert: All expected values were returned, not more """
if regular_user: diff --git a/dirsrvtests/tests/suites/linkedattrs_plugin/__init__.py b/dirsrvtests/tests/suites/linkedattrs_plugin/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/dirsrvtests/tests/suites/memberof_plugin/__init__.py b/dirsrvtests/tests/suites/memberof_plugin/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/dirsrvtests/tests/suites/mep_plugin/__init__.py b/dirsrvtests/tests/suites/mep_plugin/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/dirsrvtests/tests/suites/paged_results/paged_results_test.py b/dirsrvtests/tests/suites/paged_results/paged_results_test.py index 149a2ea..e54e293 100644 --- a/dirsrvtests/tests/suites/paged_results/paged_results_test.py +++ b/dirsrvtests/tests/suites/paged_results/paged_results_test.py @@ -247,15 +247,15 @@ def test_search_success(topology_st, test_user, page_size, users_num): """Verify that search with a simple paged results control returns all entries it should without errors.
- :Feature: Simple paged results +
389-commits@lists.fedoraproject.org