Debian Codegraph @

dirsrvtests/tests/suites/openldap_2_389/migrate_monitor_test.py

raw
1 # --- BEGIN COPYRIGHT BLOCK ---
2 # Copyright (C) 2022 William Brown <[email protected]>
3 # All rights reserved.
4 #
5 # License: GPL (version 3 or any later version).
6 # See LICENSE for details.
7 # --- END COPYRIGHT BLOCK ---
8 #
9 import pytest
10 import os
11 from test389.topologies import topology_st
12 from lib389.utils import ds_is_older
13 from lib389.migrate.openldap.config import olConfig
14 from lib389.migrate.openldap.config import olOverlayType
15 from lib389.migrate.plan import Migration
16 from lib389.plugins import MemberOfPlugin
17
18 pytestmark = pytest.mark.tier1
19
20 DATADIR1 = os.path.join(os.path.dirname(__file__), '../../data/openldap_2_389/5323/')
21
22 @pytest.mark.skipif(ds_is_older('1.4.3'), reason="Not implemented")
23 def test_migrate_openldap_monitor(topology_st):
24 """Attempt a migration with a monitor database configured.
25
26 :id: 3bf7a7e8-7482-49ee-bc3c-e5a174463844
27 :setup: Data directory with an openldap config with monitor db
28 :steps:
29 1. Parse the configuration
30 2. Execute a full migration plan
31 3. Assert monitor was skipped
32
33 :expectedresults:
34 1. Success
35 2. Success
36 3. Success
37 """
38
39 inst = topology_st.standalone
40 config_path = os.path.join(DATADIR1, 'slapd.d')
41 config = olConfig(config_path)
42
43 assert len(config.databases) == 1
44
45 ldifs = {}
46
47 migration = Migration(inst, config.schema, config.databases, ldifs)
48
49 print("==== migration plan ====")
50 print(migration.__unicode__())
51 print("==== end migration plan ====")
52
53 migration.execute_plan()
54 # End test, should suceed with no exceptions.
55
56