andykimpe / rpms / 389-ds-base

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

Blame SOURCES/0001-Issue-4747-Remove-unstable-unstatus-tests-from-PRCI-.patch

5d81fc
From 5d730f7e9f1e857bc886556db0229607b8d536d2 Mon Sep 17 00:00:00 2001
5d81fc
From: tbordaz <tbordaz@redhat.com>
5d81fc
Date: Thu, 6 May 2021 18:54:20 +0200
5d81fc
Subject: [PATCH 01/12] Issue 4747 - Remove unstable/unstatus tests from PRCI
5d81fc
 (#4748)
5d81fc
5d81fc
Bug description:
5d81fc
	Some tests (17) in the tests suite (dirsrvtest/tests/suites)
5d81fc
	are failing although there is no regression.
5d81fc
	It needs (long) investigations to status if failures
5d81fc
	are due to a bug in the tests or in DS core.
5d81fc
	Until those investigations are completes, test suites
5d81fc
	loose a large part of its value to detect regression.
5d81fc
	Indeed those failing tests may hide a real regression.
5d81fc
5d81fc
Fix description:
5d81fc
	Flag failing tests with pytest.mark.flaky(max_runs=2, min_passes=1)
5d81fc
	Additional action will be to create upstream 17 ticket to
5d81fc
	status on each failing tests
5d81fc
5d81fc
relates: https://github.com/389ds/389-ds-base/issues/4747
5d81fc
5d81fc
Reviewed by: Simon Pichugin, Viktor Ashirov (many thanks for your
5d81fc
reviews and help)
5d81fc
5d81fc
Platforms tested: F33
5d81fc
---
5d81fc
 .github/workflows/pytest.yml                  |  84 +++++
5d81fc
 dirsrvtests/tests/suites/acl/keywords_test.py |  16 +-
5d81fc
 .../tests/suites/clu/dsctl_acceptance_test.py |  56 ---
5d81fc
 .../tests/suites/clu/repl_monitor_test.py     |   2 +
5d81fc
 .../dynamic_plugins/dynamic_plugins_test.py   |   8 +-
5d81fc
 .../suites/fourwaymmr/fourwaymmr_test.py      |   3 +-
5d81fc
 .../suites/healthcheck/health_config_test.py  |   1 +
5d81fc
 .../suites/healthcheck/health_sync_test.py    |   2 +
5d81fc
 .../tests/suites/import/import_test.py        |  23 +-
5d81fc
 .../tests/suites/indexes/regression_test.py   |  63 ++++
5d81fc
 .../paged_results/paged_results_test.py       |   3 +-
5d81fc
 .../tests/suites/password/regression_test.py  |   2 +
5d81fc
 .../tests/suites/plugins/accpol_test.py       |  20 +-
5d81fc
 .../suites/plugins/managed_entry_test.py      | 351 ++++++++++++++++++
5d81fc
 .../tests/suites/plugins/memberof_test.py     |   3 +-
5d81fc
 .../suites/replication/cleanallruv_test.py    |   8 +-
5d81fc
 .../suites/replication/encryption_cl5_test.py |   8 +-
5d81fc
 .../tests/suites/retrocl/basic_test.py        | 292 ---------------
5d81fc
 18 files changed, 576 insertions(+), 369 deletions(-)
5d81fc
 create mode 100644 .github/workflows/pytest.yml
5d81fc
 delete mode 100644 dirsrvtests/tests/suites/clu/dsctl_acceptance_test.py
5d81fc
 create mode 100644 dirsrvtests/tests/suites/plugins/managed_entry_test.py
5d81fc
 delete mode 100644 dirsrvtests/tests/suites/retrocl/basic_test.py
5d81fc
5d81fc
diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml
5d81fc
new file mode 100644
5d81fc
index 000000000..015794d96
5d81fc
--- /dev/null
5d81fc
+++ b/.github/workflows/pytest.yml
5d81fc
@@ -0,0 +1,84 @@
5d81fc
+name: Test
5d81fc
+
5d81fc
+on: [push, pull_request]
5d81fc
+
5d81fc
+jobs:
5d81fc
+  build:
5d81fc
+    name: Build
5d81fc
+    runs-on: ubuntu-20.04
5d81fc
+    container:
5d81fc
+      image: quay.io/389ds/ci-images:test
5d81fc
+    outputs:
5d81fc
+        matrix: ${{ steps.set-matrix.outputs.matrix }}
5d81fc
+    steps:
5d81fc
+      - name: Checkout
5d81fc
+        uses: actions/checkout@v2
5d81fc
+
5d81fc
+      - name: Get a list of all test suites
5d81fc
+        id: set-matrix
5d81fc
+        run: echo "::set-output name=matrix::$(python3 .github/scripts/generate_matrix.py)"
5d81fc
+
5d81fc
+      - name: Build RPMs
5d81fc
+        run: cd $GITHUB_WORKSPACE && SKIP_AUDIT_CI=1 make -f rpm.mk dist-bz2 rpms
5d81fc
+
5d81fc
+      - name: Tar build artifacts
5d81fc
+        run: tar -cvf dist.tar dist/
5d81fc
+
5d81fc
+      - name: Upload RPMs
5d81fc
+        uses: actions/upload-artifact@v2
5d81fc
+        with:
5d81fc
+          name: rpms
5d81fc
+          path: dist.tar
5d81fc
+
5d81fc
+  test:
5d81fc
+    name: Test
5d81fc
+    runs-on: ubuntu-20.04
5d81fc
+    needs: build
5d81fc
+    strategy:
5d81fc
+      fail-fast: false
5d81fc
+      matrix: ${{ fromJson(needs.build.outputs.matrix) }}
5d81fc
+
5d81fc
+    steps:
5d81fc
+    - name: Checkout
5d81fc
+      uses: actions/checkout@v2
5d81fc
+
5d81fc
+    - name: Install dependencies
5d81fc
+      run: |
5d81fc
+        sudo apt update -y
5d81fc
+        sudo apt install -y docker.io containerd runc
5d81fc
+
5d81fc
+        sudo cp .github/daemon.json /etc/docker/daemon.json
5d81fc
+
5d81fc
+        sudo systemctl unmask docker
5d81fc
+        sudo systemctl start docker
5d81fc
+
5d81fc
+    - name: Download RPMs
5d81fc
+      uses: actions/download-artifact@master
5d81fc
+      with:
5d81fc
+        name: rpms
5d81fc
+    
5d81fc
+    - name: Extract RPMs
5d81fc
+      run: tar xvf dist.tar
5d81fc
+
5d81fc
+    - name: Run pytest in a container
5d81fc
+      run: |
5d81fc
+        set -x
5d81fc
+        CID=$(sudo docker run -d -h server.example.com --privileged --rm -v /sys/fs/cgroup:/sys/fs/cgroup:rw,rslave -v ${PWD}:/workspace quay.io/389ds/ci-images:test)
5d81fc
+        sudo docker exec $CID sh -c "dnf install -y -v dist/rpms/*rpm"
5d81fc
+        sudo docker exec $CID py.test  --suppress-no-test-exit-code  -m "not flaky" --junit-xml=pytest.xml -v dirsrvtests/tests/suites/${{ matrix.suite }}
5d81fc
+
5d81fc
+    - name: Make the results file readable by all
5d81fc
+      if: always()
5d81fc
+      run:
5d81fc
+        sudo chmod -f a+r pytest.xml
5d81fc
+
5d81fc
+    - name: Sanitize filename
5d81fc
+      run: echo "PYTEST_SUITE=$(echo ${{ matrix.suite }} | sed -e 's#\/#-#g')" >> $GITHUB_ENV
5d81fc
+      
5d81fc
+    - name: Upload pytest test results
5d81fc
+      if: always()
5d81fc
+      uses: actions/upload-artifact@v2
5d81fc
+      with:
5d81fc
+        name: pytest-${{ env.PYTEST_SUITE }}
5d81fc
+        path: pytest.xml
5d81fc
+ 
5d81fc
diff --git a/dirsrvtests/tests/suites/acl/keywords_test.py b/dirsrvtests/tests/suites/acl/keywords_test.py
5d81fc
index 0174152e3..c5e989f3b 100644
5d81fc
--- a/dirsrvtests/tests/suites/acl/keywords_test.py
5d81fc
+++ b/dirsrvtests/tests/suites/acl/keywords_test.py
5d81fc
@@ -216,7 +216,8 @@ def test_user_binds_without_any_password_and_cannot_access_the_data(topo, add_us
5d81fc
     with pytest.raises(ldap.INSUFFICIENT_ACCESS):
5d81fc
         org.replace("seeAlso", "cn=1")
5d81fc
 
5d81fc
-
5d81fc
+#unstable or unstatus tests, skipped for now
5d81fc
+@pytest.mark.flaky(max_runs=2, min_passes=1)
5d81fc
 def test_user_can_access_the_data_when_connecting_from_any_machine(
5d81fc
         topo, add_user, aci_of_user
5d81fc
 ):
5d81fc
@@ -245,6 +246,8 @@ def test_user_can_access_the_data_when_connecting_from_any_machine(
5d81fc
     OrganizationalUnit(conn, DNS_OU_KEY).replace("seeAlso", "cn=1")
5d81fc
 
5d81fc
 
5d81fc
+#unstable or unstatus tests, skipped for now
5d81fc
+@pytest.mark.flaky(max_runs=2, min_passes=1)
5d81fc
 def test_user_can_access_the_data_when_connecting_from_internal_ds_network_only(
5d81fc
         topo, add_user, aci_of_user
5d81fc
 ):
5d81fc
@@ -276,7 +279,8 @@ def test_user_can_access_the_data_when_connecting_from_internal_ds_network_only(
5d81fc
     # Perform Operation
5d81fc
     OrganizationalUnit(conn, DNS_OU_KEY).replace("seeAlso", "cn=1")
5d81fc
 
5d81fc
-
5d81fc
+#unstable or unstatus tests, skipped for now
5d81fc
+@pytest.mark.flaky(max_runs=2, min_passes=1)
5d81fc
 def test_user_can_access_the_data_when_connecting_from_some_network_only(
5d81fc
         topo, add_user, aci_of_user
5d81fc
 ):
5d81fc
@@ -306,7 +310,8 @@ def test_user_can_access_the_data_when_connecting_from_some_network_only(
5d81fc
     # Perform Operation
5d81fc
     OrganizationalUnit(conn, DNS_OU_KEY).replace("seeAlso", "cn=1")
5d81fc
 
5d81fc
-
5d81fc
+#unstable or unstatus tests, skipped for now
5d81fc
+@pytest.mark.flaky(max_runs=2, min_passes=1)
5d81fc
 def test_from_an_unauthorized_network(topo, add_user, aci_of_user):
5d81fc
     """User cannot access the data when connecting from an unauthorized network as per the ACI.
5d81fc
 
5d81fc
@@ -332,7 +337,8 @@ def test_from_an_unauthorized_network(topo, add_user, aci_of_user):
5d81fc
     # Perform Operation
5d81fc
     OrganizationalUnit(conn, DNS_OU_KEY).replace("seeAlso", "cn=1")
5d81fc
 
5d81fc
-
5d81fc
+#unstable or unstatus tests, skipped for now
5d81fc
+@pytest.mark.flaky(max_runs=2, min_passes=1)
5d81fc
 def test_user_cannot_access_the_data_when_connecting_from_an_unauthorized_network_2(
5d81fc
         topo, add_user, aci_of_user):
5d81fc
     """User cannot access the data when connecting from an unauthorized network as per the ACI.
5d81fc
@@ -418,6 +424,8 @@ def test_dnsalias_keyword_test_nodns_cannot(topo, add_user, aci_of_user):
5d81fc
     with pytest.raises(ldap.INSUFFICIENT_ACCESS):
5d81fc
         org.replace("seeAlso", "cn=1")
5d81fc
 
5d81fc
+#unstable or unstatus tests, skipped for now
5d81fc
+@pytest.mark.flaky(max_runs=2, min_passes=1)
5d81fc
 @pytest.mark.ds50378
5d81fc
 @pytest.mark.bz1710848
5d81fc
 @pytest.mark.parametrize("ip_addr", ['127.0.0.1', "[::1]"])
5d81fc
diff --git a/dirsrvtests/tests/suites/clu/dsctl_acceptance_test.py b/dirsrvtests/tests/suites/clu/dsctl_acceptance_test.py
5d81fc
deleted file mode 100644
5d81fc
index a0f89defd..000000000
5d81fc
--- a/dirsrvtests/tests/suites/clu/dsctl_acceptance_test.py
5d81fc
+++ /dev/null
5d81fc
@@ -1,56 +0,0 @@
5d81fc
-# --- BEGIN COPYRIGHT BLOCK ---
5d81fc
-# Copyright (C) 2021 Red Hat, Inc.
5d81fc
-# All rights reserved.
5d81fc
-#
5d81fc
-# License: GPL (version 3 or any later version).
5d81fc
-# See LICENSE for details.
5d81fc
-# --- END COPYRIGHT BLOCK ---
5d81fc
-
5d81fc
-import logging
5d81fc
-import pytest
5d81fc
-import os
5d81fc
-from lib389._constants import *
5d81fc
-from lib389.topologies import topology_st as topo
5d81fc
-
5d81fc
-log = logging.getLogger(__name__)
5d81fc
-
5d81fc
-
5d81fc
-def test_custom_path(topo):
5d81fc
-    """Test that a custom path, backup directory, is correctly used by lib389
5d81fc
-    when the server is stopped.
5d81fc
-
5d81fc
-    :id: 8659e209-ee83-477e-8183-1d2f555669ea
5d81fc
-    :setup: Standalone Instance
5d81fc
-    :steps:
5d81fc
-        1. Get the LDIF directory
5d81fc
-        2. Change the server's backup directory to the LDIF directory
5d81fc
-        3. Stop the server, and perform a backup
5d81fc
-        4. Backup was written to LDIF directory
5d81fc
-    :expectedresults:
5d81fc
-        1. Success
5d81fc
-        2. Success
5d81fc
-        3. Success
5d81fc
-        4. Success
5d81fc
-    """
5d81fc
-
5d81fc
-    # Get LDIF dir
5d81fc
-    ldif_dir = topo.standalone.get_ldif_dir()
5d81fc
-
5d81fc
-    # Set backup directory to LDIF directory
5d81fc
-    topo.standalone.config.replace('nsslapd-bakdir', ldif_dir)
5d81fc
-
5d81fc
-    # Stop the server and take a backup
5d81fc
-    topo.standalone.stop()
5d81fc
-    topo.standalone.db2bak(None)
5d81fc
-
5d81fc
-    # Verify backup was written to LDIF directory
5d81fc
-    backups = os.listdir(ldif_dir)
5d81fc
-    assert len(backups)
5d81fc
-
5d81fc
-
5d81fc
-if __name__ == '__main__':
5d81fc
-    # Run isolated
5d81fc
-    # -s for DEBUG mode
5d81fc
-    CURRENT_FILE = os.path.realpath(__file__)
5d81fc
-    pytest.main(["-s", CURRENT_FILE])
5d81fc
-
5d81fc
diff --git a/dirsrvtests/tests/suites/clu/repl_monitor_test.py b/dirsrvtests/tests/suites/clu/repl_monitor_test.py
5d81fc
index 9428edb26..3cf6343c8 100644
5d81fc
--- a/dirsrvtests/tests/suites/clu/repl_monitor_test.py
5d81fc
+++ b/dirsrvtests/tests/suites/clu/repl_monitor_test.py
5d81fc
@@ -90,6 +90,8 @@ def get_hostnames_from_log(port1, port2):
5d81fc
         host_m2 = match.group(2)
5d81fc
     return (host_m1, host_m2)
5d81fc
 
5d81fc
+#unstable or unstatus tests, skipped for now
5d81fc
+@pytest.mark.flaky(max_runs=2, min_passes=1)
5d81fc
 @pytest.mark.ds50545
5d81fc
 @pytest.mark.bz1739718
5d81fc
 @pytest.mark.skipif(ds_is_older("1.4.0"), reason="Not implemented")
5d81fc
diff --git a/dirsrvtests/tests/suites/dynamic_plugins/dynamic_plugins_test.py b/dirsrvtests/tests/suites/dynamic_plugins/dynamic_plugins_test.py
5d81fc
index b61daed74..7558cc03d 100644
5d81fc
--- a/dirsrvtests/tests/suites/dynamic_plugins/dynamic_plugins_test.py
5d81fc
+++ b/dirsrvtests/tests/suites/dynamic_plugins/dynamic_plugins_test.py
5d81fc
@@ -68,7 +68,8 @@ def check_replicas(topology_m2):
5d81fc
 
5d81fc
     log.info('Data is consistent across the replicas.\n')
5d81fc
 
5d81fc
-
5d81fc
+#unstable or unstatus tests, skipped for now
5d81fc
+@pytest.mark.flaky(max_runs=2, min_passes=1)
5d81fc
 def test_acceptance(topology_m2):
5d81fc
     """Exercise each plugin and its main features, while
5d81fc
     changing the configuration without restarting the server.
5d81fc
@@ -140,7 +141,8 @@ def test_acceptance(topology_m2):
5d81fc
     ############################################################################
5d81fc
     check_replicas(topology_m2)
5d81fc
 
5d81fc
-
5d81fc
+#unstable or unstatus tests, skipped for now
5d81fc
+@pytest.mark.flaky(max_runs=2, min_passes=1)
5d81fc
 def test_memory_corruption(topology_m2):
5d81fc
     """Check the plugins for memory corruption issues while
5d81fc
     dynamic plugins option is enabled
5d81fc
@@ -242,6 +244,8 @@ def test_memory_corruption(topology_m2):
5d81fc
     ############################################################################
5d81fc
     check_replicas(topology_m2)
5d81fc
 
5d81fc
+#unstable or unstatus tests, skipped for now
5d81fc
+@pytest.mark.flaky(max_runs=2, min_passes=1)
5d81fc
 @pytest.mark.tier2
5d81fc
 def test_stress(topology_m2):
5d81fc
     """Test plugins while under a big load. Perform the test 5 times
5d81fc
diff --git a/dirsrvtests/tests/suites/fourwaymmr/fourwaymmr_test.py b/dirsrvtests/tests/suites/fourwaymmr/fourwaymmr_test.py
5d81fc
index 5b0754a2e..c5a746ebb 100644
5d81fc
--- a/dirsrvtests/tests/suites/fourwaymmr/fourwaymmr_test.py
5d81fc
+++ b/dirsrvtests/tests/suites/fourwaymmr/fourwaymmr_test.py
5d81fc
@@ -144,7 +144,8 @@ def test_delete_a_few_entries_in_m4(topo_m4, _cleanupentris):
5d81fc
         topo_m4.ms["supplier4"], topo_m4.ms["supplier3"], 30
5d81fc
     )
5d81fc
 
5d81fc
-
5d81fc
+#unstable or unstatus tests, skipped for now
5d81fc
+@pytest.mark.flaky(max_runs=2, min_passes=1)
5d81fc
 def test_replicated_multivalued_entries(topo_m4):
5d81fc
     """
5d81fc
     Replicated multivalued entries are ordered the same way on all consumers
5d81fc
diff --git a/dirsrvtests/tests/suites/healthcheck/health_config_test.py b/dirsrvtests/tests/suites/healthcheck/health_config_test.py
5d81fc
index 3d102e859..f470c05c6 100644
5d81fc
--- a/dirsrvtests/tests/suites/healthcheck/health_config_test.py
5d81fc
+++ b/dirsrvtests/tests/suites/healthcheck/health_config_test.py
5d81fc
@@ -337,6 +337,7 @@ def test_healthcheck_low_disk_space(topology_st):
5d81fc
     os.remove(file)
5d81fc
 
5d81fc
 
5d81fc
+@pytest.mark.flaky(max_runs=2, min_passes=1)
5d81fc
 @pytest.mark.ds50791
5d81fc
 @pytest.mark.bz1843567
5d81fc
 @pytest.mark.xfail(ds_is_older("1.4.3.8"), reason="Not implemented")
5d81fc
diff --git a/dirsrvtests/tests/suites/healthcheck/health_sync_test.py b/dirsrvtests/tests/suites/healthcheck/health_sync_test.py
5d81fc
index 75bbfd35c..74df1b322 100644
5d81fc
--- a/dirsrvtests/tests/suites/healthcheck/health_sync_test.py
5d81fc
+++ b/dirsrvtests/tests/suites/healthcheck/health_sync_test.py
5d81fc
@@ -70,6 +70,8 @@ def run_healthcheck_and_flush_log(topology, instance, searched_code, json, searc
5d81fc
 @pytest.mark.ds50873
5d81fc
 @pytest.mark.bz1685160
5d81fc
 @pytest.mark.xfail(ds_is_older("1.4.1"), reason="Not implemented")
5d81fc
+#unstable or unstatus tests, skipped for now
5d81fc
+@pytest.mark.flaky(max_runs=2, min_passes=1)
5d81fc
 def test_healthcheck_replication_out_of_sync_not_broken(topology_m3):
5d81fc
     """Check if HealthCheck returns DSREPLLE0003 code
5d81fc
 
5d81fc
diff --git a/dirsrvtests/tests/suites/import/import_test.py b/dirsrvtests/tests/suites/import/import_test.py
5d81fc
index defe447d5..119b097f1 100644
5d81fc
--- a/dirsrvtests/tests/suites/import/import_test.py
5d81fc
+++ b/dirsrvtests/tests/suites/import/import_test.py
5d81fc
@@ -14,6 +14,7 @@ import os
5d81fc
 import pytest
5d81fc
 import time
5d81fc
 import glob
5d81fc
+import logging
5d81fc
 from lib389.topologies import topology_st as topo
5d81fc
 from lib389._constants import DEFAULT_SUFFIX, TaskWarning
5d81fc
 from lib389.dbgen import dbgen_users
5d81fc
@@ -28,6 +29,12 @@ from lib389.idm.account import Accounts
5d81fc
 
5d81fc
 pytestmark = pytest.mark.tier1
5d81fc
 
5d81fc
+DEBUGGING = os.getenv("DEBUGGING", default=False)
5d81fc
+if DEBUGGING:
5d81fc
+    logging.getLogger(__name__).setLevel(logging.DEBUG)
5d81fc
+else:
5d81fc
+    logging.getLogger(__name__).setLevel(logging.INFO)
5d81fc
+log = logging.getLogger(__name__)
5d81fc
 
5d81fc
 def _generate_ldif(topo, no_no):
5d81fc
     """
5d81fc
@@ -349,7 +356,8 @@ def _toggle_private_import_mem(request, topo):
5d81fc
             ('nsslapd-db-private-import-mem', 'off'))
5d81fc
     request.addfinalizer(finofaci)
5d81fc
 
5d81fc
-
5d81fc
+#unstable or unstatus tests, skipped for now
5d81fc
+@pytest.mark.flaky(max_runs=2, min_passes=1)
5d81fc
 def test_fast_slow_import(topo, _toggle_private_import_mem, _import_clean):
5d81fc
     """With nsslapd-db-private-import-mem: on is faster import.
5d81fc
 
5d81fc
@@ -381,16 +389,19 @@ def test_fast_slow_import(topo, _toggle_private_import_mem, _import_clean):
5d81fc
     # Let's set nsslapd-db-private-import-mem:on, nsslapd-import-cache-autosize: 0
5d81fc
     config = LDBMConfig(topo.standalone)
5d81fc
     # Measure offline import time duration total_time1
5d81fc
-    total_time1 = _import_offline(topo, 20)
5d81fc
+    total_time1 = _import_offline(topo, 1000)
5d81fc
     # Now nsslapd-db-private-import-mem:off
5d81fc
     config.replace('nsslapd-db-private-import-mem', 'off')
5d81fc
     accounts = Accounts(topo.standalone, DEFAULT_SUFFIX)
5d81fc
     for i in accounts.filter('(uid=*)'):
5d81fc
         UserAccount(topo.standalone, i.dn).delete()
5d81fc
     # Measure offline import time duration total_time2
5d81fc
-    total_time2 = _import_offline(topo, 20)
5d81fc
+    total_time2 = _import_offline(topo, 1000)
5d81fc
     # total_time1 < total_time2
5d81fc
+    log.info("total_time1 = %f" % total_time1)
5d81fc
+    log.info("total_time2 = %f" % total_time2)
5d81fc
     assert total_time1 < total_time2
5d81fc
+
5d81fc
     # Set nsslapd-db-private-import-mem:on, nsslapd-import-cache-autosize: -1
5d81fc
     config.replace_many(
5d81fc
         ('nsslapd-db-private-import-mem', 'on'),
5d81fc
@@ -398,14 +409,16 @@ def test_fast_slow_import(topo, _toggle_private_import_mem, _import_clean):
5d81fc
     for i in accounts.filter('(uid=*)'):
5d81fc
         UserAccount(topo.standalone, i.dn).delete()
5d81fc
     # Measure offline import time duration total_time1
5d81fc
-    total_time1 = _import_offline(topo, 20)
5d81fc
+    total_time1 = _import_offline(topo, 1000)
5d81fc
     # Now nsslapd-db-private-import-mem:off
5d81fc
     config.replace('nsslapd-db-private-import-mem', 'off')
5d81fc
     for i in accounts.filter('(uid=*)'):
5d81fc
         UserAccount(topo.standalone, i.dn).delete()
5d81fc
     # Measure offline import time duration total_time2
5d81fc
-    total_time2 = _import_offline(topo, 20)
5d81fc
+    total_time2 = _import_offline(topo, 1000)
5d81fc
     # total_time1 < total_time2
5d81fc
+    log.info("toral_time1 = %f" % total_time1)
5d81fc
+    log.info("total_time2 = %f" % total_time2)
5d81fc
     assert total_time1 < total_time2
5d81fc
 
5d81fc
 
5d81fc
diff --git a/dirsrvtests/tests/suites/indexes/regression_test.py b/dirsrvtests/tests/suites/indexes/regression_test.py
5d81fc
index 1a71f16e9..ed0c8885f 100644
5d81fc
--- a/dirsrvtests/tests/suites/indexes/regression_test.py
5d81fc
+++ b/dirsrvtests/tests/suites/indexes/regression_test.py
5d81fc
@@ -19,6 +19,68 @@ from lib389.topologies import topology_st as topo
5d81fc
 pytestmark = pytest.mark.tier1
5d81fc
 
5d81fc
 
5d81fc
+@pytest.fixture(scope="function")
5d81fc
+def add_a_group_with_users(request, topo):
5d81fc
+    """
5d81fc
+    Add a group and users, which are members of this group.
5d81fc
+    """
5d81fc
+    groups = Groups(topo.standalone, DEFAULT_SUFFIX, rdn=None)
5d81fc
+    group = groups.create(properties={'cn': 'test_group'})
5d81fc
+    users_list = []
5d81fc
+    users_num = 100
5d81fc
+    users = UserAccounts(topo.standalone, DEFAULT_SUFFIX, rdn=None)
5d81fc
+    for num in range(users_num):
5d81fc
+        USER_NAME = f'test_{num}'
5d81fc
+        user = users.create(properties={
5d81fc
+            'uid': USER_NAME,
5d81fc
+            'sn': USER_NAME,
5d81fc
+            'cn': USER_NAME,
5d81fc
+            'uidNumber': f'{num}',
5d81fc
+            'gidNumber': f'{num}',
5d81fc
+            'homeDirectory': f'/home/{USER_NAME}'
5d81fc
+        })
5d81fc
+        users_list.append(user)
5d81fc
+        group.add_member(user.dn)
5d81fc
+
5d81fc
+    def fin():
5d81fc
+        """
5d81fc
+        Removes group and users.
5d81fc
+        """
5d81fc
+        # If the server crashed, start it again to do the cleanup
5d81fc
+        if not topo.standalone.status():
5d81fc
+            topo.standalone.start()
5d81fc
+        for user in users_list:
5d81fc
+            user.delete()
5d81fc
+        group.delete()
5d81fc
+
5d81fc
+    request.addfinalizer(fin)
5d81fc
+
5d81fc
+
5d81fc
+@pytest.fixture(scope="function")
5d81fc
+def set_small_idlistscanlimit(request, topo):
5d81fc
+    """
5d81fc
+    Set nsslapd-idlistscanlimit to a smaller value to accelerate the reproducer
5d81fc
+    """
5d81fc
+    db_cfg = DatabaseConfig(topo.standalone)
5d81fc
+    old_idlistscanlimit = db_cfg.get_attr_vals_utf8('nsslapd-idlistscanlimit')
5d81fc
+    db_cfg.set([('nsslapd-idlistscanlimit', '100')])
5d81fc
+    topo.standalone.restart()
5d81fc
+
5d81fc
+    def fin():
5d81fc
+        """
5d81fc
+        Set nsslapd-idlistscanlimit back to the default value
5d81fc
+        """
5d81fc
+        # If the server crashed, start it again to do the cleanup
5d81fc
+        if not topo.standalone.status():
5d81fc
+            topo.standalone.start()
5d81fc
+        db_cfg.set([('nsslapd-idlistscanlimit', old_idlistscanlimit)])
5d81fc
+        topo.standalone.restart()
5d81fc
+
5d81fc
+    request.addfinalizer(fin)
5d81fc
+
5d81fc
+#unstable or unstatus tests, skipped for now
5d81fc
+@pytest.mark.flaky(max_runs=2, min_passes=1)
5d81fc
+@pytest.mark.skipif(ds_is_older("1.4.4.4"), reason="Not implemented")
5d81fc
 def test_reindex_task_creates_abandoned_index_file(topo):
5d81fc
     """
5d81fc
     Recreating an index for the same attribute but changing
5d81fc
@@ -123,3 +185,4 @@ if __name__ == "__main__":
5d81fc
     # -s for DEBUG mode
5d81fc
     CURRENT_FILE = os.path.realpath(__file__)
5d81fc
     pytest.main("-s %s" % CURRENT_FILE)
5d81fc
+
5d81fc
diff --git a/dirsrvtests/tests/suites/paged_results/paged_results_test.py b/dirsrvtests/tests/suites/paged_results/paged_results_test.py
5d81fc
index 9fdceb165..0b45b7d96 100644
5d81fc
--- a/dirsrvtests/tests/suites/paged_results/paged_results_test.py
5d81fc
+++ b/dirsrvtests/tests/suites/paged_results/paged_results_test.py
5d81fc
@@ -506,7 +506,8 @@ def test_search_with_timelimit(topology_st, create_user):
5d81fc
     finally:
5d81fc
         del_users(users_list)
5d81fc
 
5d81fc
-
5d81fc
+#unstable or unstatus tests, skipped for now
5d81fc
+@pytest.mark.flaky(max_runs=2, min_passes=1)
5d81fc
 @pytest.mark.parametrize('aci_subject',
5d81fc
                          ('dns = "{}"'.format(HOSTNAME),
5d81fc
                           'ip = "{}"'.format(IP_ADDRESS)))
5d81fc
diff --git a/dirsrvtests/tests/suites/password/regression_test.py b/dirsrvtests/tests/suites/password/regression_test.py
5d81fc
index 251834421..8f1facb6d 100644
5d81fc
--- a/dirsrvtests/tests/suites/password/regression_test.py
5d81fc
+++ b/dirsrvtests/tests/suites/password/regression_test.py
5d81fc
@@ -215,6 +215,8 @@ def test_global_vs_local(topo, passw_policy, create_user, user_pasw):
5d81fc
     # reset password
5d81fc
     create_user.set('userPassword', PASSWORD)
5d81fc
 
5d81fc
+#unstable or unstatus tests, skipped for now
5d81fc
+@pytest.mark.flaky(max_runs=2, min_passes=1)
5d81fc
 @pytest.mark.ds49789
5d81fc
 def test_unhashed_pw_switch(topo_supplier):
5d81fc
     """Check that nsslapd-unhashed-pw-switch works corrently
5d81fc
diff --git a/dirsrvtests/tests/suites/plugins/accpol_test.py b/dirsrvtests/tests/suites/plugins/accpol_test.py
5d81fc
index 73e2e54d1..77975c747 100644
5d81fc
--- a/dirsrvtests/tests/suites/plugins/accpol_test.py
5d81fc
+++ b/dirsrvtests/tests/suites/plugins/accpol_test.py
5d81fc
@@ -520,7 +520,8 @@ def test_glinact_limit(topology_st, accpol_global):
5d81fc
     modify_attr(topology_st, ACCP_CONF, 'accountInactivityLimit', '12')
5d81fc
     del_users(topology_st, suffix, subtree, userid, nousrs)
5d81fc
 
5d81fc
-
5d81fc
+#unstable or unstatus tests, skipped for now
5d81fc
+@pytest.mark.flaky(max_runs=2, min_passes=1)
5d81fc
 def test_glnologin_attr(topology_st, accpol_global):
5d81fc
     """Verify if user account is inactivated based on createTimeStamp attribute, no lastLoginTime attribute present
5d81fc
 
5d81fc
@@ -610,7 +611,8 @@ def test_glnologin_attr(topology_st, accpol_global):
5d81fc
     account_status(topology_st, suffix, subtree, userid, nousrs, 0, "Enabled")
5d81fc
     del_users(topology_st, suffix, subtree, userid, nousrs)
5d81fc
 
5d81fc
-
5d81fc
+#unstable or unstatus tests, skipped for now
5d81fc
+@pytest.mark.flaky(max_runs=2, min_passes=1)
5d81fc
 def test_glnoalt_stattr(topology_st, accpol_global):
5d81fc
     """Verify if user account can be inactivated based on lastLoginTime attribute, altstateattrname set to 1.1
5d81fc
 
5d81fc
@@ -656,6 +658,8 @@ def test_glnoalt_stattr(topology_st, accpol_global):
5d81fc
     del_users(topology_st, suffix, subtree, userid, nousrs)
5d81fc
 
5d81fc
 
5d81fc
+#unstable or unstatus tests, skipped for now
5d81fc
+@pytest.mark.flaky(max_runs=2, min_passes=1)
5d81fc
 def test_glattr_modtime(topology_st, accpol_global):
5d81fc
     """Verify if user account can be inactivated based on modifyTimeStamp attribute
5d81fc
 
5d81fc
@@ -705,6 +709,8 @@ def test_glattr_modtime(topology_st, accpol_global):
5d81fc
     del_users(topology_st, suffix, subtree, userid, nousrs)
5d81fc
 
5d81fc
 
5d81fc
+#unstable or unstatus tests, skipped for now
5d81fc
+@pytest.mark.flaky(max_runs=2, min_passes=1)
5d81fc
 def test_glnoalt_nologin(topology_st, accpol_global):
5d81fc
     """Verify if account policy plugin works if we set altstateattrname set to 1.1 and alwaysrecordlogin to NO
5d81fc
 
5d81fc
@@ -763,6 +769,8 @@ def test_glnoalt_nologin(topology_st, accpol_global):
5d81fc
     del_users(topology_st, suffix, subtree, userid, nousrs)
5d81fc
 
5d81fc
 
5d81fc
+#unstable or unstatus tests, skipped for now
5d81fc
+@pytest.mark.flaky(max_runs=2, min_passes=1)
5d81fc
 def test_glinact_nsact(topology_st, accpol_global):
5d81fc
     """Verify if user account can be activated using ns-activate.pl script.
5d81fc
 
5d81fc
@@ -812,6 +820,8 @@ def test_glinact_nsact(topology_st, accpol_global):
5d81fc
     del_users(topology_st, suffix, subtree, userid, nousrs)
5d81fc
 
5d81fc
 
5d81fc
+#unstable or unstatus tests, skipped for now
5d81fc
+@pytest.mark.flaky(max_runs=2, min_passes=1)
5d81fc
 def test_glinact_acclock(topology_st, accpol_global):
5d81fc
     """Verify if user account is activated when account is unlocked by passwordlockoutduration.
5d81fc
 
5d81fc
@@ -868,6 +878,8 @@ def test_glinact_acclock(topology_st, accpol_global):
5d81fc
     del_users(topology_st, suffix, subtree, userid, nousrs)
5d81fc
 
5d81fc
 
5d81fc
+#unstable or unstatus tests, skipped for now
5d81fc
+@pytest.mark.flaky(max_runs=2, min_passes=1)
5d81fc
 def test_glnact_pwexp(topology_st, accpol_global):
5d81fc
     """Verify if user account is activated when password is reset after password is expired
5d81fc
 
5d81fc
@@ -951,6 +963,8 @@ def test_glnact_pwexp(topology_st, accpol_global):
5d81fc
     del_users(topology_st, suffix, subtree, userid, nousrs)
5d81fc
 
5d81fc
 
5d81fc
+#unstable or unstatus tests, skipped for now
5d81fc
+@pytest.mark.flaky(max_runs=2, min_passes=1)
5d81fc
 def test_locact_inact(topology_st, accpol_local):
5d81fc
     """Verify if user account is inactivated when accountInactivityLimit is exceeded.
5d81fc
 
5d81fc
@@ -995,6 +1009,8 @@ def test_locact_inact(topology_st, accpol_local):
5d81fc
     del_users(topology_st, suffix, subtree, userid, nousrs)
5d81fc
 
5d81fc
 
5d81fc
+#unstable or unstatus tests, skipped for now
5d81fc
+@pytest.mark.flaky(max_runs=2, min_passes=1)
5d81fc
 def test_locinact_modrdn(topology_st, accpol_local):
5d81fc
     """Verify if user account is inactivated when moved from ou=groups to ou=people subtree.
5d81fc
 
5d81fc
diff --git a/dirsrvtests/tests/suites/plugins/managed_entry_test.py b/dirsrvtests/tests/suites/plugins/managed_entry_test.py
5d81fc
new file mode 100644
5d81fc
index 000000000..662044ccd
5d81fc
--- /dev/null
5d81fc
+++ b/dirsrvtests/tests/suites/plugins/managed_entry_test.py
5d81fc
@@ -0,0 +1,351 @@
5d81fc
+# --- BEGIN COPYRIGHT BLOCK ---
5d81fc
+# Copyright (C) 2020 Red Hat, Inc.
5d81fc
+# All rights reserved.
5d81fc
+#
5d81fc
+# License: GPL (version 3 or any later version).
5d81fc
+# See LICENSE for details.
5d81fc
+# --- END COPYRIGHT BLOCK ---
5d81fc
+#
5d81fc
+import pytest
5d81fc
+import time
5d81fc
+from lib389.topologies import topology_st as topo
5d81fc
+from lib389.idm.user import UserAccount, UserAccounts
5d81fc
+from lib389.idm.account import Account, Accounts
5d81fc
+from lib389._constants import DEFAULT_SUFFIX
5d81fc
+from lib389.idm.group import Groups
5d81fc
+from lib389.config import Config
5d81fc
+from lib389.idm.organizationalunit import OrganizationalUnits, OrganizationalUnit
5d81fc
+from lib389.plugins import MEPTemplates, MEPConfigs, ManagedEntriesPlugin, MEPTemplate
5d81fc
+from lib389.idm.nscontainer import nsContainers
5d81fc
+from lib389.idm.domain import Domain
5d81fc
+from lib389.tasks import Entry
5d81fc
+import ldap
5d81fc
+
5d81fc
+pytestmark = pytest.mark.tier1
5d81fc
+USER_PASSWORD = 'password'
5d81fc
+
5d81fc
+
5d81fc
+@pytest.fixture(scope="module")
5d81fc
+def _create_inital(topo):
5d81fc
+    """
5d81fc
+    Will create entries for this module
5d81fc
+    """
5d81fc
+    meps = MEPTemplates(topo.standalone, DEFAULT_SUFFIX)
5d81fc
+    mep_template1 = meps.create(
5d81fc
+        properties={'cn': 'UPG Template', 'mepRDNAttr': 'cn', 'mepStaticAttr': 'objectclass: posixGroup',
5d81fc
+                    'mepMappedAttr': 'cn: $uid|gidNumber: $gidNumber|description: User private group for $uid'.split(
5d81fc
+                        '|')})
5d81fc
+    conf_mep = MEPConfigs(topo.standalone)
5d81fc
+    conf_mep.create(properties={'cn': 'UPG Definition1', 'originScope': f'cn=Users,{DEFAULT_SUFFIX}',
5d81fc
+                                             'originFilter': 'objectclass=posixaccount',
5d81fc
+                                             'managedBase': f'cn=Groups,{DEFAULT_SUFFIX}',
5d81fc
+                                             'managedTemplate': mep_template1.dn})
5d81fc
+    container = nsContainers(topo.standalone, DEFAULT_SUFFIX)
5d81fc
+    for cn in ['Users', 'Groups']:
5d81fc
+        container.create(properties={'cn': cn})
5d81fc
+
5d81fc
+
5d81fc
+def test_binddn_tracking(topo, _create_inital):
5d81fc
+    """Test Managed Entries basic functionality
5d81fc
+
5d81fc
+    :id: ea2ddfd4-aaec-11ea-8416-8c16451d917b
5d81fc
+    :setup: Standalone Instance
5d81fc
+    :steps:
5d81fc
+        1. Set nsslapd-plugin-binddn-tracking attribute under cn=config
5d81fc
+        2. Add user
5d81fc
+        3. Managed Entry Plugin runs against managed entries upon any update without validating
5d81fc
+        4. verify creation of User Private Group with its time stamp value
5d81fc
+        5. Modify the SN attribute which is not mapped with managed entry
5d81fc
+        6. run ModRDN operation and check the User Private group
5d81fc
+        7. Check the time stamp of UPG should be changed now
5d81fc
+        8. Check the creatorsname should be user dn and internalCreatorsname should be plugin name
5d81fc
+        9. Check if a managed group entry was created
5d81fc
+    :expected results:
5d81fc
+        1. Success
5d81fc
+        2. Success
5d81fc
+        3. Success
5d81fc
+        4. Success
5d81fc
+        5. Success
5d81fc
+        6. Success
5d81fc
+        7. Success
5d81fc
+        8. Success
5d81fc
+        9. Success
5d81fc
+    """
5d81fc
+    config = Config(topo.standalone)
5d81fc
+    # set nsslapd-plugin-binddn-tracking attribute under cn=config
5d81fc
+    config.replace('nsslapd-plugin-binddn-tracking', 'on')
5d81fc
+    # Add user
5d81fc
+    user = UserAccounts(topo.standalone, f'cn=Users,{DEFAULT_SUFFIX}', rdn=None).create_test_user()
5d81fc
+    assert user.get_attr_val_utf8('mepManagedEntry') == f'cn=test_user_1000,cn=Groups,{DEFAULT_SUFFIX}'
5d81fc
+    entry = Account(topo.standalone, f'cn=test_user_1000,cn=Groups,{DEFAULT_SUFFIX}')
5d81fc
+    # Managed Entry Plugin runs against managed entries upon any update without validating
5d81fc
+    # verify creation of User Private Group with its time stamp value
5d81fc
+    stamp1 = entry.get_attr_val_utf8('modifyTimestamp')
5d81fc
+    user.replace('sn', 'NewSN_modified')
5d81fc
+    stamp2 = entry.get_attr_val_utf8('modifyTimestamp')
5d81fc
+    # Modify the SN attribute which is not mapped with managed entry
5d81fc
+    # Check the time stamp of UPG should not be changed
5d81fc
+    assert stamp1 == stamp2
5d81fc
+    time.sleep(1)
5d81fc
+    # run ModRDN operation and check the User Private group
5d81fc
+    user.rename(new_rdn='uid=UserNewRDN', newsuperior='cn=Users,dc=example,dc=com')
5d81fc
+    assert user.get_attr_val_utf8('mepManagedEntry') == f'cn=UserNewRDN,cn=Groups,{DEFAULT_SUFFIX}'
5d81fc
+    entry = Account(topo.standalone, f'cn=UserNewRDN,cn=Groups,{DEFAULT_SUFFIX}')
5d81fc
+    stamp3 = entry.get_attr_val_utf8('modifyTimestamp')
5d81fc
+    # Check the time stamp of UPG should be changed now
5d81fc
+    assert stamp2 != stamp3
5d81fc
+    time.sleep(1)
5d81fc
+    user.replace('gidNumber', '1')
5d81fc
+    stamp4 = entry.get_attr_val_utf8('modifyTimestamp')
5d81fc
+    assert stamp4 != stamp3
5d81fc
+    # Check the creatorsname should be user dn and internalCreatorsname should be plugin name
5d81fc
+    assert entry.get_attr_val_utf8('creatorsname') == 'cn=directory manager'
5d81fc
+    assert entry.get_attr_val_utf8('internalCreatorsname') == 'cn=Managed Entries,cn=plugins,cn=config'
5d81fc
+    assert entry.get_attr_val_utf8('modifiersname') == 'cn=directory manager'
5d81fc
+    user.delete()
5d81fc
+    config.replace('nsslapd-plugin-binddn-tracking', 'off')
5d81fc
+
5d81fc
+
5d81fc
+class WithObjectClass(Account):
5d81fc
+    def __init__(self, instance, dn=None):
5d81fc
+        super(WithObjectClass, self).__init__(instance, dn)
5d81fc
+        self._rdn_attribute = 'uid'
5d81fc
+        self._create_objectclasses = ['top', 'person', 'inetorgperson']
5d81fc
+
5d81fc
+#unstable or unstatus tests, skipped for now
5d81fc
+@pytest.mark.flaky(max_runs=2, min_passes=1)
5d81fc
+def test_mentry01(topo, _create_inital):
5d81fc
+    """Test Managed Entries basic functionality
5d81fc
+
5d81fc
+    :id: 9b87493b-0493-46f9-8364-6099d0e5d806
5d81fc
+    :setup: Standalone Instance
5d81fc
+    :steps:
5d81fc
+        1. Check the plug-in status
5d81fc
+        2. Add Template and definition entry
5d81fc
+        3. Add our org units
5d81fc
+        4. Add users with PosixAccount ObjectClass and verify creation of User Private Group
5d81fc
+        5. Disable the plug-in and check the status
5d81fc
+        6. Enable the plug-in and check the status the plug-in is disabled and creation of UPG should fail
5d81fc
+        7. Add users with PosixAccount ObjectClass and verify creation of User Private Group
5d81fc
+        8. Add users, run ModRDN operation and check the User Private group
5d81fc
+        9. Add users, run LDAPMODIFY to change the gidNumber and check the User Private group
5d81fc
+        10. Checking whether creation of User Private group fails for existing group entry
5d81fc
+        11. Checking whether adding of posixAccount objectClass to existing user creates UPG
5d81fc
+        12. Running ModRDN operation and checking the user private groups mepManagedBy attribute
5d81fc
+        13. Deleting mepManagedBy attribute and running ModRDN operation to check if it creates a new UPG
5d81fc
+        14. Change the RDN of template entry, DSA Unwilling to perform error expected
5d81fc
+        15. Change the RDN of cn=Users to cn=TestUsers and check UPG are deleted
5d81fc
+    :expected results:
5d81fc
+        1. Success
5d81fc
+        2. Success
5d81fc
+        3. Success
5d81fc
+        4. Success
5d81fc
+        5. Success
5d81fc
+        6. Success
5d81fc
+        7. Success
5d81fc
+        8. Success
5d81fc
+        9. Success
5d81fc
+        10. Success
5d81fc
+        11. Success
5d81fc
+        12. Success
5d81fc
+        13. Success
5d81fc
+        14. Fail(Unwilling to perform )
5d81fc
+        15. Success
5d81fc
+    """
5d81fc
+    # Check the plug-in status
5d81fc
+    mana = ManagedEntriesPlugin(topo.standalone)
5d81fc
+    assert mana.status()
5d81fc
+    # Add Template and definition entry
5d81fc
+    org1 = OrganizationalUnits(topo.standalone, DEFAULT_SUFFIX).create(properties={'ou': 'Users'})
5d81fc
+    org2 = OrganizationalUnit(topo.standalone, f'ou=Groups,{DEFAULT_SUFFIX}')
5d81fc
+    meps = MEPTemplates(topo.standalone, DEFAULT_SUFFIX)
5d81fc
+    mep_template1 = meps.create(properties={
5d81fc
+        'cn': 'UPG Template1',
5d81fc
+        'mepRDNAttr': 'cn',
5d81fc
+        'mepStaticAttr': 'objectclass: posixGroup',
5d81fc
+        'mepMappedAttr': 'cn: $uid|gidNumber: $gidNumber|description: User private group for $uid'.split('|')})
5d81fc
+    conf_mep = MEPConfigs(topo.standalone)
5d81fc
+    mep_config = conf_mep.create(properties={
5d81fc
+        'cn': 'UPG Definition2',
5d81fc
+        'originScope': org1.dn,
5d81fc
+        'originFilter': 'objectclass=posixaccount',
5d81fc
+        'managedBase': org2.dn,
5d81fc
+        'managedTemplate': mep_template1.dn})
5d81fc
+    # Add users with PosixAccount ObjectClass and verify creation of User Private Group
5d81fc
+    user = UserAccounts(topo.standalone, f'ou=Users,{DEFAULT_SUFFIX}', rdn=None).create_test_user()
5d81fc
+    assert user.get_attr_val_utf8('mepManagedEntry') == f'cn=test_user_1000,ou=Groups,{DEFAULT_SUFFIX}'
5d81fc
+    # Disable the plug-in and check the status
5d81fc
+    mana.disable()
5d81fc
+    user.delete()
5d81fc
+    topo.standalone.restart()
5d81fc
+    # Add users with PosixAccount ObjectClass when the plug-in is disabled and creation of UPG should fail
5d81fc
+    user = UserAccounts(topo.standalone, f'ou=Users,{DEFAULT_SUFFIX}', rdn=None).create_test_user()
5d81fc
+    assert not user.get_attr_val_utf8('mepManagedEntry')
5d81fc
+    # Enable the plug-in and check the status
5d81fc
+    mana.enable()
5d81fc
+    user.delete()
5d81fc
+    topo.standalone.restart()
5d81fc
+    # Add users with PosixAccount ObjectClass and verify creation of User Private Group
5d81fc
+    user = UserAccounts(topo.standalone, f'ou=Users,{DEFAULT_SUFFIX}', rdn=None).create_test_user()
5d81fc
+    assert user.get_attr_val_utf8('mepManagedEntry') == f'cn=test_user_1000,ou=Groups,{DEFAULT_SUFFIX}'
5d81fc
+    # Add users, run ModRDN operation and check the User Private group
5d81fc
+    # Add users, run LDAPMODIFY to change the gidNumber and check the User Private group
5d81fc
+    user.rename(new_rdn='uid=UserNewRDN', newsuperior='ou=Users,dc=example,dc=com')
5d81fc
+    assert user.get_attr_val_utf8('mepManagedEntry') == f'cn=UserNewRDN,ou=Groups,{DEFAULT_SUFFIX}'
5d81fc
+    user.replace('gidNumber', '20209')
5d81fc
+    entry = Account(topo.standalone, f'cn=UserNewRDN,ou=Groups,{DEFAULT_SUFFIX}')
5d81fc
+    assert entry.get_attr_val_utf8('gidNumber') == '20209'
5d81fc
+    user.replace_many(('sn', 'new_modified_sn'), ('gidNumber', '31309'))
5d81fc
+    assert entry.get_attr_val_utf8('gidNumber') == '31309'
5d81fc
+    user.delete()
5d81fc
+    # Checking whether creation of User Private group fails for existing group entry
5d81fc
+    grp = Groups(topo.standalone, f'ou=Groups,{DEFAULT_SUFFIX}', rdn=None).create(properties={'cn': 'MENTRY_14'})
5d81fc
+    user = UserAccounts(topo.standalone, f'ou=Users,{DEFAULT_SUFFIX}', rdn=None).create_test_user()
5d81fc
+    with pytest.raises(ldap.NO_SUCH_OBJECT):
5d81fc
+        entry.status()
5d81fc
+    user.delete()
5d81fc
+    # Checking whether adding of posixAccount objectClass to existing user creates UPG
5d81fc
+    # Add Users without posixAccount objectClass
5d81fc
+    users = WithObjectClass(topo.standalone, f'uid=test_test, ou=Users,{DEFAULT_SUFFIX}')
5d81fc
+    user_properties1 = {'uid': 'test_test', 'cn': 'test', 'sn': 'test', 'mail': 'sasa@sasa.com', 'telephoneNumber': '123'}
5d81fc
+    user = users.create(properties=user_properties1)
5d81fc
+    assert not user.get_attr_val_utf8('mepManagedEntry')
5d81fc
+    # Add posixAccount objectClass
5d81fc
+    user.replace_many(('objectclass', ['top', 'person', 'inetorgperson', 'posixAccount']),
5d81fc
+                      ('homeDirectory', '/home/ok'),
5d81fc
+                      ('uidNumber', '61603'), ('gidNumber', '61603'))
5d81fc
+    assert not user.get_attr_val_utf8('mepManagedEntry')
5d81fc
+    user = UserAccounts(topo.standalone, f'ou=Users,{DEFAULT_SUFFIX}', rdn=None).create_test_user()
5d81fc
+    entry = Account(topo.standalone, 'cn=test_user_1000,ou=Groups,dc=example,dc=com')
5d81fc
+    # Add inetuser objectClass
5d81fc
+    user.replace_many(
5d81fc
+        ('objectclass', ['top', 'account', 'posixaccount', 'inetOrgPerson',
5d81fc
+                         'organizationalPerson', 'nsMemberOf', 'nsAccount',
5d81fc
+                         'person', 'mepOriginEntry', 'inetuser']),
5d81fc
+        ('memberOf', entry.dn))
5d81fc
+    assert entry.status()
5d81fc
+    user.delete()
5d81fc
+    user = UserAccounts(topo.standalone, f'ou=Users,{DEFAULT_SUFFIX}', rdn=None).create_test_user()
5d81fc
+    entry = Account(topo.standalone, 'cn=test_user_1000,ou=Groups,dc=example,dc=com')
5d81fc
+    # Add groupofNames objectClass
5d81fc
+    user.replace_many(
5d81fc
+        ('objectclass', ['top', 'account', 'posixaccount', 'inetOrgPerson',
5d81fc
+                         'organizationalPerson', 'nsMemberOf', 'nsAccount',
5d81fc
+                         'person', 'mepOriginEntry', 'groupofNames']),
5d81fc
+        ('memberOf', user.dn))
5d81fc
+    assert entry.status()
5d81fc
+    # Running ModRDN operation and checking the user private groups mepManagedBy attribute
5d81fc
+    user.replace('mepManagedEntry', f'uid=CheckModRDN,ou=Users,{DEFAULT_SUFFIX}')
5d81fc
+    user.rename(new_rdn='uid=UserNewRDN', newsuperior='ou=Users,dc=example,dc=com')
5d81fc
+    assert user.get_attr_val_utf8('mepManagedEntry') == f'uid=CheckModRDN,ou=Users,{DEFAULT_SUFFIX}'
5d81fc
+    # Deleting mepManagedBy attribute and running ModRDN operation to check if it creates a new UPG
5d81fc
+    user.remove('mepManagedEntry', f'uid=CheckModRDN,ou=Users,{DEFAULT_SUFFIX}')
5d81fc
+    user.rename(new_rdn='uid=UserNewRDN1', newsuperior='ou=Users,dc=example,dc=com')
5d81fc
+    assert user.get_attr_val_utf8('mepManagedEntry') == f'cn=UserNewRDN1,ou=Groups,{DEFAULT_SUFFIX}'
5d81fc
+    # Change the RDN of template entry, DSA Unwilling to perform error expected
5d81fc
+    mep = MEPTemplate(topo.standalone, f'cn=UPG Template,{DEFAULT_SUFFIX}')
5d81fc
+    with pytest.raises(ldap.UNWILLING_TO_PERFORM):
5d81fc
+        mep.rename(new_rdn='cn=UPG Template2', newsuperior='dc=example,dc=com')
5d81fc
+    # Change the RDN of cn=Users to cn=TestUsers and check UPG are deleted
5d81fc
+    before = user.get_attr_val_utf8('mepManagedEntry')
5d81fc
+    user.rename(new_rdn='uid=Anuj', newsuperior='ou=Users,dc=example,dc=com')
5d81fc
+    assert user.get_attr_val_utf8('mepManagedEntry') != before
5d81fc
+
5d81fc
+
5d81fc
+def test_managed_entry_removal(topo):
5d81fc
+    """Check that we can't remove managed entry manually
5d81fc
+
5d81fc
+    :id: cf9c5be5-97ef-46fc-b199-8346acf4c296
5d81fc
+    :setup: Standalone Instance
5d81fc
+    :steps:
5d81fc
+        1. Enable the plugin
5d81fc
+        2. Restart the instance
5d81fc
+        3. Add our org units
5d81fc
+        4. Set up config entry and template entry for the org units
5d81fc
+        5. Add an entry that meets the MEP scope
5d81fc
+        6. Check if a managed group entry was created
5d81fc
+        7. Try to remove the entry while bound as Admin (non-DM)
5d81fc
+        8. Remove the entry while bound as DM
5d81fc
+        9. Check that the managing entry can be deleted too
5d81fc
+    :expectedresults:
5d81fc
+        1. Success
5d81fc
+        2. Success
5d81fc
+        3. Success
5d81fc
+        4. Success
5d81fc
+        5. Success
5d81fc
+        6. Success
5d81fc
+        7. Should fail
5d81fc
+        8. Success
5d81fc
+        9. Success
5d81fc
+    """
5d81fc
+
5d81fc
+    inst = topo.standalone
5d81fc
+
5d81fc
+    # Add ACI so we can test that non-DM user can't delete managed entry
5d81fc
+    domain = Domain(inst, DEFAULT_SUFFIX)
5d81fc
+    ACI_TARGET = f"(target = \"ldap:///{DEFAULT_SUFFIX}\")"
5d81fc
+    ACI_TARGETATTR = "(targetattr = *)"
5d81fc
+    ACI_ALLOW = "(version 3.0; acl \"Admin Access\"; allow (all) "
5d81fc
+    ACI_SUBJECT = "(userdn = \"ldap:///anyone\");)"
5d81fc
+    ACI_BODY = ACI_TARGET + ACI_TARGETATTR + ACI_ALLOW + ACI_SUBJECT
5d81fc
+    domain.add('aci', ACI_BODY)
5d81fc
+
5d81fc
+    # stop the plugin, and start it
5d81fc
+    plugin = ManagedEntriesPlugin(inst)
5d81fc
+    plugin.disable()
5d81fc
+    plugin.enable()
5d81fc
+
5d81fc
+    # Add our org units
5d81fc
+    ous = OrganizationalUnits(inst, DEFAULT_SUFFIX)
5d81fc
+    ou_people = ous.create(properties={'ou': 'managed_people'})
5d81fc
+    ou_groups = ous.create(properties={'ou': 'managed_groups'})
5d81fc
+
5d81fc
+    mep_templates = MEPTemplates(inst, DEFAULT_SUFFIX)
5d81fc
+    mep_template1 = mep_templates.create(properties={
5d81fc
+        'cn': 'MEP template',
5d81fc
+        'mepRDNAttr': 'cn',
5d81fc
+        'mepStaticAttr': 'objectclass: groupOfNames|objectclass: extensibleObject'.split('|'),
5d81fc
+        'mepMappedAttr': 'cn: $cn|uid: $cn|gidNumber: $uidNumber'.split('|')
5d81fc
+    })
5d81fc
+    mep_configs = MEPConfigs(inst)
5d81fc
+    mep_configs.create(properties={'cn': 'config',
5d81fc
+                                   'originScope': ou_people.dn,
5d81fc
+                                   'originFilter': 'objectclass=posixAccount',
5d81fc
+                                   'managedBase': ou_groups.dn,
5d81fc
+                                   'managedTemplate': mep_template1.dn})
5d81fc
+    inst.restart()
5d81fc
+
5d81fc
+    # Add an entry that meets the MEP scope
5d81fc
+    test_users_m1 = UserAccounts(inst, DEFAULT_SUFFIX, rdn='ou={}'.format(ou_people.rdn))
5d81fc
+    managing_entry = test_users_m1.create_test_user(1001)
5d81fc
+    managing_entry.reset_password(USER_PASSWORD)
5d81fc
+    user_bound_conn = managing_entry.bind(USER_PASSWORD)
5d81fc
+
5d81fc
+    # Get the managed entry
5d81fc
+    managed_groups = Groups(inst, ou_groups.dn, rdn=None)
5d81fc
+    managed_entry = managed_groups.get(managing_entry.rdn)
5d81fc
+
5d81fc
+    # Check that the managed entry was created
5d81fc
+    assert managed_entry.exists()
5d81fc
+
5d81fc
+    # Try to remove the entry while bound as Admin (non-DM)
5d81fc
+    managed_groups_user_conn = Groups(user_bound_conn, ou_groups.dn, rdn=None)
5d81fc
+    managed_entry_user_conn = managed_groups_user_conn.get(managed_entry.rdn)
5d81fc
+    with pytest.raises(ldap.UNWILLING_TO_PERFORM):
5d81fc
+        managed_entry_user_conn.delete()
5d81fc
+    assert managed_entry_user_conn.exists()
5d81fc
+
5d81fc
+    # Remove the entry while bound as DM
5d81fc
+    managed_entry.delete()
5d81fc
+    assert not managed_entry.exists()
5d81fc
+
5d81fc
+    # Check that the managing entry can be deleted too
5d81fc
+    managing_entry.delete()
5d81fc
+    assert not managing_entry.exists()
5d81fc
+
5d81fc
+
5d81fc
+if __name__ == '__main__':
5d81fc
+    # Run isolated
5d81fc
+    # -s for DEBUG mode
5d81fc
+    CURRENT_FILE = os.path.realpath(__file__)
5d81fc
+    pytest.main("-s %s" % CURRENT_FILE)
5d81fc
diff --git a/dirsrvtests/tests/suites/plugins/memberof_test.py b/dirsrvtests/tests/suites/plugins/memberof_test.py
5d81fc
index bc99eef7d..d3b32c856 100644
5d81fc
--- a/dirsrvtests/tests/suites/plugins/memberof_test.py
5d81fc
+++ b/dirsrvtests/tests/suites/plugins/memberof_test.py
5d81fc
@@ -2655,7 +2655,8 @@ def test_complex_group_scenario_9(topology_st):
5d81fc
     verify_post_025(topology_st, memofegrp020_1, memofegrp020_2, memofegrp020_3, memofegrp020_4, memofegrp020_5,
5d81fc
                     memofuser1, memofuser2, memofuser3, memofuser4)
5d81fc
 
5d81fc
-
5d81fc
+#unstable or unstatus tests, skipped for now
5d81fc
+@pytest.mark.flaky(max_runs=2, min_passes=1)
5d81fc
 def test_memberof_auto_add_oc(topology_st):
5d81fc
     """Test the auto add objectclass (OC) feature. The plugin should add a predefined
5d81fc
     objectclass that will allow memberOf to be added to an entry.
5d81fc
diff --git a/dirsrvtests/tests/suites/replication/cleanallruv_test.py b/dirsrvtests/tests/suites/replication/cleanallruv_test.py
5d81fc
index 5610e3c19..f0cd99cfc 100644
5d81fc
--- a/dirsrvtests/tests/suites/replication/cleanallruv_test.py
5d81fc
+++ b/dirsrvtests/tests/suites/replication/cleanallruv_test.py
5d81fc
@@ -223,7 +223,7 @@ def test_clean(topology_m4, m4rid):
5d81fc
 
5d81fc
     log.info('test_clean PASSED, restoring supplier 4...')
5d81fc
 
5d81fc
-
5d81fc
+@pytest.mark.flaky(max_runs=2, min_passes=1)
5d81fc
 def test_clean_restart(topology_m4, m4rid):
5d81fc
     """Check that cleanallruv task works properly after a restart
5d81fc
 
5d81fc
@@ -295,6 +295,7 @@ def test_clean_restart(topology_m4, m4rid):
5d81fc
     log.info('test_clean_restart PASSED, restoring supplier 4...')
5d81fc
 
5d81fc
 
5d81fc
+@pytest.mark.flaky(max_runs=2, min_passes=1)
5d81fc
 def test_clean_force(topology_m4, m4rid):
5d81fc
     """Check that multiple tasks with a 'force' option work properly
5d81fc
 
5d81fc
@@ -353,6 +354,7 @@ def test_clean_force(topology_m4, m4rid):
5d81fc
     log.info('test_clean_force PASSED, restoring supplier 4...')
5d81fc
 
5d81fc
 
5d81fc
+@pytest.mark.flaky(max_runs=2, min_passes=1)
5d81fc
 def test_abort(topology_m4, m4rid):
5d81fc
     """Test the abort task basic functionality
5d81fc
 
5d81fc
@@ -408,6 +410,7 @@ def test_abort(topology_m4, m4rid):
5d81fc
     log.info('test_abort PASSED, restoring supplier 4...')
5d81fc
 
5d81fc
 
5d81fc
+@pytest.mark.flaky(max_runs=2, min_passes=1)
5d81fc
 def test_abort_restart(topology_m4, m4rid):
5d81fc
     """Test the abort task can handle a restart, and then resume
5d81fc
 
5d81fc
@@ -486,6 +489,7 @@ def test_abort_restart(topology_m4, m4rid):
5d81fc
     log.info('test_abort_restart PASSED, restoring supplier 4...')
5d81fc
 
5d81fc
 
5d81fc
+@pytest.mark.flaky(max_runs=2, min_passes=1)
5d81fc
 def test_abort_certify(topology_m4, m4rid):
5d81fc
     """Test the abort task with a replica-certify-all option
5d81fc
 
5d81fc
@@ -555,6 +559,7 @@ def test_abort_certify(topology_m4, m4rid):
5d81fc
     log.info('test_abort_certify PASSED, restoring supplier 4...')
5d81fc
 
5d81fc
 
5d81fc
+@pytest.mark.flaky(max_runs=2, min_passes=1)
5d81fc
 def test_stress_clean(topology_m4, m4rid):
5d81fc
     """Put each server(m1 - m4) under a stress, and perform the entire clean process
5d81fc
 
5d81fc
@@ -641,6 +646,7 @@ def test_stress_clean(topology_m4, m4rid):
5d81fc
     ldbm_config.set('nsslapd-readonly', 'off')
5d81fc
 
5d81fc
 
5d81fc
+@pytest.mark.flaky(max_runs=2, min_passes=1)
5d81fc
 def test_multiple_tasks_with_force(topology_m4, m4rid):
5d81fc
     """Check that multiple tasks with a 'force' option work properly
5d81fc
 
5d81fc
diff --git a/dirsrvtests/tests/suites/replication/encryption_cl5_test.py b/dirsrvtests/tests/suites/replication/encryption_cl5_test.py
5d81fc
index 7ae7e1b13..b69863f53 100644
5d81fc
--- a/dirsrvtests/tests/suites/replication/encryption_cl5_test.py
5d81fc
+++ b/dirsrvtests/tests/suites/replication/encryption_cl5_test.py
5d81fc
@@ -73,10 +73,10 @@ def _check_unhashed_userpw_encrypted(inst, change_type, user_dn, user_pw, is_enc
5d81fc
                 assert user_pw_attr in entry, 'Changelog entry does not contain clear text password'
5d81fc
     assert count, 'Operation type and DN of the entry not matched in changelog'
5d81fc
 
5d81fc
-
5d81fc
-@pytest.mark.parametrize("encryption", ["AES", "3DES"])
5d81fc
-def test_algorithm_unhashed(topology_with_tls, encryption):
5d81fc
-    """Check encryption algowithm AES and 3DES.
5d81fc
+#unstable or unstatus tests, skipped for now
5d81fc
+@pytest.mark.flaky(max_runs=2, min_passes=1)
5d81fc
+def test_algorithm_unhashed(topology_with_tls):
5d81fc
+    """Check encryption algorithm AES
5d81fc
     And check unhashed#user#password attribute for encryption.
5d81fc
 
5d81fc
     :id: b7a37bf8-4b2e-4dbd-9891-70117d67558c
5d81fc
diff --git a/dirsrvtests/tests/suites/retrocl/basic_test.py b/dirsrvtests/tests/suites/retrocl/basic_test.py
5d81fc
deleted file mode 100644
5d81fc
index 112c73cb9..000000000
5d81fc
--- a/dirsrvtests/tests/suites/retrocl/basic_test.py
5d81fc
+++ /dev/null
5d81fc
@@ -1,292 +0,0 @@
5d81fc
-# --- BEGIN COPYRIGHT BLOCK ---
5d81fc
-# Copyright (C) 2021 Red Hat, Inc.
5d81fc
-# All rights reserved.
5d81fc
-#
5d81fc
-# License: GPL (version 3 or any later version).
5d81fc
-# See LICENSE for details.
5d81fc
-# --- END COPYRIGHT BLOCK ---
5d81fc
-
5d81fc
-import logging
5d81fc
-import ldap
5d81fc
-import time
5d81fc
-import pytest
5d81fc
-from lib389.topologies import topology_st
5d81fc
-from lib389.plugins import RetroChangelogPlugin
5d81fc
-from lib389._constants import *
5d81fc
-from lib389.utils import *
5d81fc
-from lib389.tasks import *
5d81fc
-from lib389.cli_base import FakeArgs, connect_instance, disconnect_instance
5d81fc
-from lib389.cli_base.dsrc import dsrc_arg_concat
5d81fc
-from lib389.cli_conf.plugins.retrochangelog import retrochangelog_add
5d81fc
-from lib389.idm.user import UserAccount, UserAccounts, nsUserAccounts
5d81fc
-
5d81fc
-pytestmark = pytest.mark.tier1
5d81fc
-
5d81fc
-USER1_DN = 'uid=user1,ou=people,'+ DEFAULT_SUFFIX
5d81fc
-USER2_DN = 'uid=user2,ou=people,'+ DEFAULT_SUFFIX
5d81fc
-USER_PW = 'password'
5d81fc
-ATTR_HOMEPHONE = 'homePhone'
5d81fc
-ATTR_CARLICENSE = 'carLicense'
5d81fc
-
5d81fc
-log = logging.getLogger(__name__)
5d81fc
-
5d81fc
-def test_retrocl_exclude_attr_add(topology_st):
5d81fc
-    """ Test exclude attribute feature of the retrocl plugin for add operation
5d81fc
-
5d81fc
-    :id: 3481650f-2070-45ef-9600-2500cfc51559
5d81fc
-
5d81fc
-    :setup: Standalone instance
5d81fc
-
5d81fc
-    :steps:
5d81fc
-        1. Enable dynamic plugins
5d81fc
-        2. Confige retro changelog plugin
5d81fc
-        3. Add an entry
5d81fc
-        4. Ensure entry attrs are in the changelog
5d81fc
-        5. Exclude an attr
5d81fc
-        6. Add another entry
5d81fc
-        7. Ensure excluded attr is not in the changelog
5d81fc
-
5d81fc
-    :expectedresults:
5d81fc
-        1. Success
5d81fc
-        2. Success
5d81fc
-        3. Success
5d81fc
-        4. Success
5d81fc
-        5. Success
5d81fc
-        6. Success
5d81fc
-        7. Success
5d81fc
-    """
5d81fc
-
5d81fc
-    st = topology_st.standalone
5d81fc
-
5d81fc
-    log.info('Enable dynamic plugins')
5d81fc
-    try:
5d81fc
-        st.config.set('nsslapd-dynamic-plugins', 'on')
5d81fc
-    except ldap.LDAPError as e:
5d81fc
-        ldap.error('Failed to enable dynamic plugins ' + e.args[0]['desc'])
5d81fc
-        assert False
5d81fc
-
5d81fc
-    log.info('Configure retrocl plugin')
5d81fc
-    rcl = RetroChangelogPlugin(st)
5d81fc
-    rcl.disable()
5d81fc
-    rcl.enable()
5d81fc
-    rcl.replace('nsslapd-attribute', 'nsuniqueid:targetUniqueId')
5d81fc
-
5d81fc
-    log.info('Restarting instance')
5d81fc
-    try:
5d81fc
-        st.restart()
5d81fc
-    except ldap.LDAPError as e:
5d81fc
-        ldap.error('Failed to restart instance ' + e.args[0]['desc'])
5d81fc
-        assert False
5d81fc
-
5d81fc
-    users = UserAccounts(st, DEFAULT_SUFFIX)
5d81fc
-
5d81fc
-    log.info('Adding user1')
5d81fc
-    try:
5d81fc
-        user1 = users.create(properties={
5d81fc
-            'sn': '1',
5d81fc
-            'cn': 'user 1',
5d81fc
-            'uid': 'user1',
5d81fc
-            'uidNumber': '11',
5d81fc
-            'gidNumber': '111',
5d81fc
-            'givenname': 'user1',
5d81fc
-            'homePhone': '0861234567',
5d81fc
-            'carLicense': '131D16674',
5d81fc
-            'mail': 'user1@whereever.com',
5d81fc
-            'homeDirectory': '/home/user1',
5d81fc
-            'userpassword': USER_PW})
5d81fc
-    except ldap.ALREADY_EXISTS:
5d81fc
-        pass
5d81fc
-    except ldap.LDAPError as e:
5d81fc
-        log.error("Failed to add user1")
5d81fc
-
5d81fc
-    log.info('Verify homePhone and carLicense attrs are in the changelog changestring')
5d81fc
-    try:
5d81fc
-        cllist = st.search_s(RETROCL_SUFFIX, ldap.SCOPE_SUBTREE, '(targetDn=%s)' % USER1_DN)
5d81fc
-    except ldap.LDAPError as e:
5d81fc
-        log.fatal("Changelog search failed, error: " +str(e))
5d81fc
-        assert False
5d81fc
-    assert len(cllist) > 0
5d81fc
-    if  cllist[0].hasAttr('changes'):
5d81fc
-        clstr = (cllist[0].getValue('changes')).decode()
5d81fc
-        assert ATTR_HOMEPHONE in clstr
5d81fc
-        assert ATTR_CARLICENSE in clstr
5d81fc
-
5d81fc
-    log.info('Excluding attribute ' + ATTR_HOMEPHONE)
5d81fc
-    args = FakeArgs()
5d81fc
-    args.connections = [st.host + ':' + str(st.port) + ':' + DN_DM + ':' + PW_DM]
5d81fc
-    args.instance = 'standalone1'
5d81fc
-    args.basedn = None
5d81fc
-    args.binddn = None
5d81fc
-    args.starttls = False
5d81fc
-    args.pwdfile = None
5d81fc
-    args.bindpw = None
5d81fc
-    args.prompt = False
5d81fc
-    args.exclude_attrs = ATTR_HOMEPHONE
5d81fc
-    args.func = retrochangelog_add
5d81fc
-    dsrc_inst = dsrc_arg_concat(args, None)
5d81fc
-    inst = connect_instance(dsrc_inst, False, args)
5d81fc
-    result = args.func(inst, None, log, args)
5d81fc
-    disconnect_instance(inst)
5d81fc
-    assert result is None
5d81fc
-
5d81fc
-    log.info("5s delay for retrocl plugin to restart")
5d81fc
-    time.sleep(5)
5d81fc
-
5d81fc
-    log.info('Adding user2')
5d81fc
-    try:
5d81fc
-        user2 = users.create(properties={
5d81fc
-            'sn': '2',
5d81fc
-            'cn': 'user 2',
5d81fc
-            'uid': 'user2',
5d81fc
-            'uidNumber': '22',
5d81fc
-            'gidNumber': '222',
5d81fc
-            'givenname': 'user2',
5d81fc
-            'homePhone': '0879088363',
5d81fc
-            'carLicense': '04WX11038',
5d81fc
-            'mail': 'user2@whereever.com',
5d81fc
-            'homeDirectory': '/home/user2',
5d81fc
-            'userpassword': USER_PW})
5d81fc
-    except ldap.ALREADY_EXISTS:
5d81fc
-        pass
5d81fc
-    except ldap.LDAPError as e:
5d81fc
-        log.error("Failed to add user2")
5d81fc
-
5d81fc
-    log.info('Verify homePhone attr is not in the changelog changestring')
5d81fc
-    try:
5d81fc
-        cllist = st.search_s(RETROCL_SUFFIX, ldap.SCOPE_SUBTREE, '(targetDn=%s)' % USER2_DN)
5d81fc
-        assert len(cllist) > 0
5d81fc
-        if  cllist[0].hasAttr('changes'):
5d81fc
-            clstr = (cllist[0].getValue('changes')).decode()
5d81fc
-            assert ATTR_HOMEPHONE not in clstr
5d81fc
-            assert ATTR_CARLICENSE in clstr
5d81fc
-    except ldap.LDAPError as e:
5d81fc
-        log.fatal("Changelog search failed, error: " +str(e))
5d81fc
-        assert False
5d81fc
-
5d81fc
-def test_retrocl_exclude_attr_mod(topology_st):
5d81fc
-    """ Test exclude attribute feature of the retrocl plugin for mod operation
5d81fc
-
5d81fc
-    :id: f6bef689-685b-4f86-a98d-f7e6b1fcada3
5d81fc
-
5d81fc
-    :setup: Standalone instance
5d81fc
-
5d81fc
-    :steps:
5d81fc
-        1. Enable dynamic plugins
5d81fc
-        2. Confige retro changelog plugin
5d81fc
-        3. Add user1 entry
5d81fc
-        4. Ensure entry attrs are in the changelog
5d81fc
-        5. Exclude an attr
5d81fc
-        6. Modify user1 entry
5d81fc
-        7. Ensure excluded attr is not in the changelog
5d81fc
-
5d81fc
-    :expectedresults:
5d81fc
-        1. Success
5d81fc
-        2. Success
5d81fc
-        3. Success
5d81fc
-        4. Success
5d81fc
-        5. Success
5d81fc
-        6. Success
5d81fc
-        7. Success
5d81fc
-    """
5d81fc
-
5d81fc
-    st = topology_st.standalone
5d81fc
-
5d81fc
-    log.info('Enable dynamic plugins')
5d81fc
-    try:
5d81fc
-        st.config.set('nsslapd-dynamic-plugins', 'on')
5d81fc
-    except ldap.LDAPError as e:
5d81fc
-        ldap.error('Failed to enable dynamic plugins ' + e.args[0]['desc'])
5d81fc
-        assert False
5d81fc
-
5d81fc
-    log.info('Configure retrocl plugin')
5d81fc
-    rcl = RetroChangelogPlugin(st)
5d81fc
-    rcl.disable()
5d81fc
-    rcl.enable()
5d81fc
-    rcl.replace('nsslapd-attribute', 'nsuniqueid:targetUniqueId')
5d81fc
-
5d81fc
-    log.info('Restarting instance')
5d81fc
-    try:
5d81fc
-        st.restart()
5d81fc
-    except ldap.LDAPError as e:
5d81fc
-        ldap.error('Failed to restart instance ' + e.args[0]['desc'])
5d81fc
-        assert False
5d81fc
-
5d81fc
-    users = UserAccounts(st, DEFAULT_SUFFIX)
5d81fc
-
5d81fc
-    log.info('Adding user1')
5d81fc
-    try:
5d81fc
-        user1 = users.create(properties={
5d81fc
-            'sn': '1',
5d81fc
-            'cn': 'user 1',
5d81fc
-            'uid': 'user1',
5d81fc
-            'uidNumber': '11',
5d81fc
-            'gidNumber': '111',
5d81fc
-            'givenname': 'user1',
5d81fc
-            'homePhone': '0861234567',
5d81fc
-            'carLicense': '131D16674',
5d81fc
-            'mail': 'user1@whereever.com',
5d81fc
-            'homeDirectory': '/home/user1',
5d81fc
-            'userpassword': USER_PW})
5d81fc
-    except ldap.ALREADY_EXISTS:
5d81fc
-        pass
5d81fc
-    except ldap.LDAPError as e:
5d81fc
-        log.error("Failed to add user1")
5d81fc
-
5d81fc
-    log.info('Verify homePhone and carLicense attrs are in the changelog changestring')
5d81fc
-    try:
5d81fc
-        cllist = st.search_s(RETROCL_SUFFIX, ldap.SCOPE_SUBTREE, '(targetDn=%s)' % USER1_DN)
5d81fc
-    except ldap.LDAPError as e:
5d81fc
-        log.fatal("Changelog search failed, error: " +str(e))
5d81fc
-        assert False
5d81fc
-    assert len(cllist) > 0
5d81fc
-    if  cllist[0].hasAttr('changes'):
5d81fc
-        clstr = (cllist[0].getValue('changes')).decode()
5d81fc
-        assert ATTR_HOMEPHONE in clstr
5d81fc
-        assert ATTR_CARLICENSE in clstr
5d81fc
-
5d81fc
-    log.info('Excluding attribute ' + ATTR_CARLICENSE)
5d81fc
-    args = FakeArgs()
5d81fc
-    args.connections = [st.host + ':' + str(st.port) + ':' + DN_DM + ':' + PW_DM]
5d81fc
-    args.instance = 'standalone1'
5d81fc
-    args.basedn = None
5d81fc
-    args.binddn = None
5d81fc
-    args.starttls = False
5d81fc
-    args.pwdfile = None
5d81fc
-    args.bindpw = None
5d81fc
-    args.prompt = False
5d81fc
-    args.exclude_attrs = ATTR_CARLICENSE
5d81fc
-    args.func = retrochangelog_add
5d81fc
-    dsrc_inst = dsrc_arg_concat(args, None)
5d81fc
-    inst = connect_instance(dsrc_inst, False, args)
5d81fc
-    result = args.func(inst, None, log, args)
5d81fc
-    disconnect_instance(inst)
5d81fc
-    assert result is None
5d81fc
-
5d81fc
-    log.info("5s delay for retrocl plugin to restart")
5d81fc
-    time.sleep(5)
5d81fc
-
5d81fc
-    log.info('Modify user1 carLicense attribute')
5d81fc
-    try:
5d81fc
-        st.modify_s(USER1_DN, [(ldap.MOD_REPLACE, ATTR_CARLICENSE, b"123WX321")])
5d81fc
-    except ldap.LDAPError as e:
5d81fc
-        log.fatal('test_retrocl_exclude_attr_mod: Failed to update user1 attribute: error ' + e.message['desc'])
5d81fc
-        assert False
5d81fc
-
5d81fc
-    log.info('Verify carLicense attr is not in the changelog changestring')
5d81fc
-    try:
5d81fc
-        cllist = st.search_s(RETROCL_SUFFIX, ldap.SCOPE_SUBTREE, '(targetDn=%s)' % USER1_DN)
5d81fc
-        assert len(cllist) > 0
5d81fc
-        # There will be 2 entries in the changelog for this user, we are only
5d81fc
-        #interested in the second one, the modify operation.
5d81fc
-        if  cllist[1].hasAttr('changes'):
5d81fc
-            clstr = (cllist[1].getValue('changes')).decode()
5d81fc
-            assert ATTR_CARLICENSE not in clstr
5d81fc
-    except ldap.LDAPError as e:
5d81fc
-        log.fatal("Changelog search failed, error: " +str(e))
5d81fc
-        assert False
5d81fc
-
5d81fc
-if __name__ == '__main__':
5d81fc
-    # Run isolated
5d81fc
-    # -s for DEBUG mode
5d81fc
-    CURRENT_FILE = os.path.realpath(__file__)
5d81fc
-    pytest.main("-s %s" % CURRENT_FILE)
5d81fc
-- 
5d81fc
2.26.3
5d81fc