andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone

Blame SOURCES/0036-Issue-4513-CI-Tests-fix-test-failures.patch

3280a9
From 4839898dbe69d6445f3571beec1bf3f1557d6cc6 Mon Sep 17 00:00:00 2001
3280a9
From: Mark Reynolds <mreynolds@redhat.com>
3280a9
Date: Tue, 12 Jan 2021 10:09:23 -0500
3280a9
Subject: [PATCH] Issue 4513 - CI Tests - fix test failures
3280a9
3280a9
Description:
3280a9
3280a9
    Fixed tests in these suites:  basic, entryuuid, filter, lib389, and schema
3280a9
3280a9
relates: https://github.com/389ds/389-ds-base/issues/4513
3280a9
3280a9
Reviewed by: progier(Thanks!)
3280a9
---
3280a9
 dirsrvtests/tests/suites/basic/basic_test.py  | 65 ++++++++++---------
3280a9
 .../filter/rfc3673_all_oper_attrs_test.py     |  4 +-
3280a9
 .../suites/lib389/config_compare_test.py      |  5 +-
3280a9
 .../suites/lib389/idm/user_compare_i2_test.py |  3 +
3280a9
 .../tests/suites/schema/schema_reload_test.py |  3 +
3280a9
 5 files changed, 47 insertions(+), 33 deletions(-)
3280a9
3280a9
diff --git a/dirsrvtests/tests/suites/basic/basic_test.py b/dirsrvtests/tests/suites/basic/basic_test.py
3280a9
index 97908c31c..fc9af46e4 100644
3280a9
--- a/dirsrvtests/tests/suites/basic/basic_test.py
3280a9
+++ b/dirsrvtests/tests/suites/basic/basic_test.py
3280a9
@@ -1059,6 +1059,41 @@ def test_search_ou(topology_st):
3280a9
     assert len(entries) == 0
3280a9
 
3280a9
 
3280a9
+def test_bind_invalid_entry(topology_st):
3280a9
+    """Test the failing bind does not return information about the entry
3280a9
+
3280a9
+    :id: 5cd9b083-eea6-426b-84ca-83c26fc49a6f
3280a9
+
3280a9
+    :setup: Standalone instance
3280a9
+
3280a9
+    :steps:
3280a9
+    1: bind as non existing entry
3280a9
+    2: check that bind info does not report 'No such entry'
3280a9
+
3280a9
+    :expectedresults:
3280a9
+    1: pass
3280a9
+    2: pass
3280a9
+    """
3280a9
+
3280a9
+    topology_st.standalone.restart()
3280a9
+    INVALID_ENTRY="cn=foooo,%s" % DEFAULT_SUFFIX
3280a9
+    try:
3280a9
+        topology_st.standalone.simple_bind_s(INVALID_ENTRY, PASSWORD)
3280a9
+    except ldap.LDAPError as e:
3280a9
+        log.info('test_bind_invalid_entry: Failed to bind as %s (expected)' % INVALID_ENTRY)
3280a9
+        log.info('exception description: ' + e.args[0]['desc'])
3280a9
+        if 'info' in e.args[0]:
3280a9
+            log.info('exception info: ' + e.args[0]['info'])
3280a9
+        assert e.args[0]['desc'] == 'Invalid credentials'
3280a9
+        assert 'info' not in e.args[0]
3280a9
+        pass
3280a9
+
3280a9
+    log.info('test_bind_invalid_entry: PASSED')
3280a9
+
3280a9
+    # reset credentials
3280a9
+    topology_st.standalone.simple_bind_s(DN_DM, PW_DM)
3280a9
+
3280a9
+
3280a9
 @pytest.mark.bz1044135
3280a9
 @pytest.mark.ds47319
3280a9
 def test_connection_buffer_size(topology_st):
3280a9
@@ -1477,36 +1512,6 @@ def test_dscreate_with_different_rdn(dscreate_test_rdn_value):
3280a9
         else:
3280a9
             assert True
3280a9
 
3280a9
-def test_bind_invalid_entry(topology_st):
3280a9
-    """Test the failing bind does not return information about the entry
3280a9
-
3280a9
-    :id: 5cd9b083-eea6-426b-84ca-83c26fc49a6f
3280a9
-
3280a9
-    :setup: Standalone instance
3280a9
-
3280a9
-    :steps:
3280a9
-    1: bind as non existing entry
3280a9
-    2: check that bind info does not report 'No such entry'
3280a9
-
3280a9
-    :expectedresults:
3280a9
-    1: pass
3280a9
-    2: pass
3280a9
-    """
3280a9
-
3280a9
-    topology_st.standalone.restart()
3280a9
-    INVALID_ENTRY="cn=foooo,%s" % DEFAULT_SUFFIX
3280a9
-    try:
3280a9
-        topology_st.standalone.simple_bind_s(INVALID_ENTRY, PASSWORD)
3280a9
-    except ldap.LDAPError as e:
3280a9
-        log.info('test_bind_invalid_entry: Failed to bind as %s (expected)' % INVALID_ENTRY)
3280a9
-        log.info('exception description: ' + e.args[0]['desc'])
3280a9
-        if 'info' in e.args[0]:
3280a9
-            log.info('exception info: ' + e.args[0]['info'])
3280a9
-        assert e.args[0]['desc'] == 'Invalid credentials'
3280a9
-        assert 'info' not in e.args[0]
3280a9
-        pass
3280a9
-
3280a9
-    log.info('test_bind_invalid_entry: PASSED')
3280a9
 
3280a9
 
3280a9
 if __name__ == '__main__':
3280a9
diff --git a/dirsrvtests/tests/suites/filter/rfc3673_all_oper_attrs_test.py b/dirsrvtests/tests/suites/filter/rfc3673_all_oper_attrs_test.py
3280a9
index c882bea5f..0477acda7 100644
3280a9
--- a/dirsrvtests/tests/suites/filter/rfc3673_all_oper_attrs_test.py
3280a9
+++ b/dirsrvtests/tests/suites/filter/rfc3673_all_oper_attrs_test.py
3280a9
@@ -53,11 +53,11 @@ TEST_PARAMS = [(DN_ROOT, False, [
3280a9
                (TEST_USER_DN, False, [
3280a9
                 'createTimestamp', 'creatorsName', 'entrydn',
3280a9
                 'entryid', 'modifiersName', 'modifyTimestamp',
3280a9
-                'nsUniqueId', 'parentid'
3280a9
+                'nsUniqueId', 'parentid', 'entryUUID'
3280a9
                ]),
3280a9
                (TEST_USER_DN, True, [
3280a9
                 'createTimestamp', 'creatorsName', 'entrydn',
3280a9
-                'entryid', 'modifyTimestamp', 'nsUniqueId', 'parentid'
3280a9
+                'entryid', 'modifyTimestamp', 'nsUniqueId', 'parentid', 'entryUUID'
3280a9
                ]),
3280a9
                (DN_CONFIG, False, [
3280a9
                 'numSubordinates', 'passwordHistory'
3280a9
diff --git a/dirsrvtests/tests/suites/lib389/config_compare_test.py b/dirsrvtests/tests/suites/lib389/config_compare_test.py
3280a9
index 709bae8cb..84f55acfa 100644
3280a9
--- a/dirsrvtests/tests/suites/lib389/config_compare_test.py
3280a9
+++ b/dirsrvtests/tests/suites/lib389/config_compare_test.py
3280a9
@@ -22,15 +22,18 @@ def test_config_compare(topology_i2):
3280a9
     st2_config = topology_i2.ins.get('standalone2').config
3280a9
     # 'nsslapd-port' attribute is expected to be same in cn=config comparison,
3280a9
     # but they are different in our testing environment
3280a9
-    # as we are using 2 DS instances running, both running simultaneuosly.
3280a9
+    # as we are using 2 DS instances running, both running simultaneously.
3280a9
     # Hence explicitly adding 'nsslapd-port' to compare_exclude.
3280a9
     st1_config._compare_exclude.append('nsslapd-port')
3280a9
     st2_config._compare_exclude.append('nsslapd-port')
3280a9
     st1_config._compare_exclude.append('nsslapd-secureport')
3280a9
     st2_config._compare_exclude.append('nsslapd-secureport')
3280a9
+    st1_config._compare_exclude.append('nsslapd-ldapssotoken-secret')
3280a9
+    st2_config._compare_exclude.append('nsslapd-ldapssotoken-secret')
3280a9
 
3280a9
     assert Config.compare(st1_config, st2_config)
3280a9
 
3280a9
+
3280a9
 if __name__ == '__main__':
3280a9
     # Run isolated
3280a9
     # -s for DEBUG mode
3280a9
diff --git a/dirsrvtests/tests/suites/lib389/idm/user_compare_i2_test.py b/dirsrvtests/tests/suites/lib389/idm/user_compare_i2_test.py
3280a9
index c7540e4ce..ccde0f6b0 100644
3280a9
--- a/dirsrvtests/tests/suites/lib389/idm/user_compare_i2_test.py
3280a9
+++ b/dirsrvtests/tests/suites/lib389/idm/user_compare_i2_test.py
3280a9
@@ -39,6 +39,9 @@ def test_user_compare_i2(topology_i2):
3280a9
     st2_users.create(properties=user_properties)
3280a9
     st2_testuser = st2_users.get('testuser')
3280a9
 
3280a9
+    st1_testuser._compare_exclude.append('entryuuid')
3280a9
+    st2_testuser._compare_exclude.append('entryuuid')
3280a9
+
3280a9
     assert UserAccount.compare(st1_testuser, st2_testuser)
3280a9
 
3280a9
 
3280a9
diff --git a/dirsrvtests/tests/suites/schema/schema_reload_test.py b/dirsrvtests/tests/suites/schema/schema_reload_test.py
3280a9
index 2ece5dda5..e7e7d833d 100644
3280a9
--- a/dirsrvtests/tests/suites/schema/schema_reload_test.py
3280a9
+++ b/dirsrvtests/tests/suites/schema/schema_reload_test.py
3280a9
@@ -54,6 +54,7 @@ def test_valid_schema(topo):
3280a9
             schema_file.write("objectclasses: ( 1.2.3.4.5.6.7.8 NAME 'TestObject' " +
3280a9
                               "SUP top MUST ( objectclass $ cn ) MAY ( givenName $ " +
3280a9
                               "sn $ ValidAttribute ) X-ORIGIN 'user defined' )')\n")
3280a9
+        os.chmod(schema_filename, 0o777)
3280a9
     except OSError as e:
3280a9
         log.fatal("Failed to create schema file: " +
3280a9
                   "{} Error: {}".format(schema_filename, str(e)))
3280a9
@@ -106,6 +107,7 @@ def test_invalid_schema(topo):
3280a9
             schema_file.write("objectclasses: ( 1.2.3.4.5.6.7 NAME 'MoZiLLaOBJeCT' " +
3280a9
                               "SUP top MUST ( objectclass $ cn ) MAY ( givenName $ " +
3280a9
                               "sn $ MozillaAttribute ) X-ORIGIN 'user defined' )')\n")
3280a9
+        os.chmod(schema_filename, 0o777)
3280a9
     except OSError as e:
3280a9
         log.fatal("Failed to create schema file: " +
3280a9
                   "{} Error: {}".format(schema_filename, str(e)))
3280a9
@@ -122,6 +124,7 @@ def test_invalid_schema(topo):
3280a9
             schema_file.write("objectclasses: ( 1.2.3.4.5.6.70 NAME 'MoZiLLaOBJeCT' " +
3280a9
                               "SUP top MUST ( objectclass $ cn ) MAY ( givenName $ " +
3280a9
                               "cn $ MoZiLLaATTRiBuTe ) X-ORIGIN 'user defined' )')\n")
3280a9
+        os.chmod(schema_filename, 0o777)
3280a9
     except OSError as e:
3280a9
         log.fatal("Failed to create schema file: " +
3280a9
                   "{} Error: {}".format(schema_filename, str(e)))
3280a9
-- 
3280a9
2.26.2
3280a9