Debian Codegraph @

dirsrvtests/tests/suites/ds_tools/replcheck_test.py

raw
1 # --- BEGIN COPYRIGHT BLOCK ---
2 # Copyright (C) 2018 Red Hat, Inc.
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 subprocess
11 from lib389.utils import *
12 from lib389.replica import Replicas, Replica, ReplicationManager
13 from lib389._constants import *
14 from lib389.config import CertmapLegacy
15 from lib389.idm.nscontainer import nsContainers
16 from lib389.idm.user import UserAccounts, TEST_USER_PROPERTIES
17 from lib389.idm.services import ServiceAccounts
18 from test389.topologies import topology_m2 as topo
19
20 pytestmark = pytest.mark.tier1
21
22 DEBUGGING = os.getenv("DEBUGGING", default=False)
23 if DEBUGGING:
24 logging.getLogger(__name__).setLevel(logging.DEBUG)
25 else:
26 logging.getLogger(__name__).setLevel(logging.INFO)
27 log = logging.getLogger(__name__)
28
29
30 def _create_container(inst, dn, name):
31 """Creates container entry"""
32
33 conts = nsContainers(inst, dn)
34 cont = conts.create(properties={'cn': name})
35 time.sleep(1)
36 return cont
37
38
39 def _delete_container(cont):
40 """Deletes container entry"""
41
42 cont.delete()
43 time.sleep(1)
44
45
46 @pytest.fixture(scope="module")
47 def topo_tls_ldapi(topo):
48 """Enable TLS on both suppliers and reconfigure both agreements
49 to use TLS Client auth. Also, setup ldapi and export DB
50 """
51
52 m1 = topo.ms["supplier1"]
53 m2 = topo.ms["supplier2"]
54 # Create the certmap before we restart for enable_tls
55 cm_m1 = CertmapLegacy(m1)
56 cm_m2 = CertmapLegacy(m2)
57
58 # We need to configure the same maps for both ....
59 certmaps = cm_m1.list()
60 certmaps['default']['DNComps'] = None
61 certmaps['default']['CmapLdapAttr'] = 'nsCertSubjectDN'
62
63 cm_m1.set(certmaps)
64 cm_m2.set(certmaps)
65
66 [i.enable_tls() for i in topo]
67
68 # Create the replication dns
69 services = ServiceAccounts(m1, DEFAULT_SUFFIX)
70 repl_m1 = services.get(f'{DEFAULT_SUFFIX}:{m1.host}:{m1.sslport}')
71 repl_m1.set('nsCertSubjectDN', m1.get_server_tls_subject())
72
73 repl_m2 = services.get(f'{DEFAULT_SUFFIX}:{m2.host}:{m2.sslport}')
74 repl_m2.set('nsCertSubjectDN', m2.get_server_tls_subject())
75
76 # Check the replication is "done".
77 repl = ReplicationManager(DEFAULT_SUFFIX)
78 repl.wait_for_replication(m1, m2)
79 # Now change the auth type
80
81 replica_m1 = Replicas(m1).get(DEFAULT_SUFFIX)
82 agmt_m1 = replica_m1.get_agreements().list()[0]
83
84 agmt_m1.replace_many(
85 ('nsDS5ReplicaBindMethod', 'SSLCLIENTAUTH'),
86 ('nsDS5ReplicaTransportInfo', 'SSL'),
87 ('nsDS5ReplicaPort', '%s' % m2.sslport),
88 )
89 agmt_m1.remove_all('nsDS5ReplicaBindDN')
90
91 replica_m2 = Replicas(m2).get(DEFAULT_SUFFIX)
92 agmt_m2 = replica_m2.get_agreements().list()[0]
93
94 agmt_m2.replace_many(
95 ('nsDS5ReplicaBindMethod', 'SSLCLIENTAUTH'),
96 ('nsDS5ReplicaTransportInfo', 'SSL'),
97 ('nsDS5ReplicaPort', '%s' % m1.sslport),
98 )
99 agmt_m2.remove_all('nsDS5ReplicaBindDN')
100
101 log.info("Export LDAPTLS_CACERTDIR env variable for ds-replcheck")
102 os.environ["LDAPTLS_CACERTDIR"] = m1.get_ssca_dir()
103
104 for inst in topo:
105 inst.config.set('nsslapd-ldapilisten', 'on')
106 inst.config.set('nsslapd-ldapifilepath', '/var/run/slapd-{}.socket'.format(inst.serverid))
107 inst.restart()
108
109 repl.test_replication(m1, m2)
110 repl.test_replication(m2, m1)
111
112 return topo
113
114
115 def replcheck_cmd_list(topo_tls_ldapi):
116 """Check ds-replcheck tool through ldap, ldaps, ldap with StartTLS, ldapi
117 and compare exported ldif files
118 """
119
120 m1 = topo_tls_ldapi.ms["supplier1"]
121 m2 = topo_tls_ldapi.ms["supplier2"]
122
123 for inst in topo_tls_ldapi:
124 inst.stop()
125 inst.db2ldif(bename=DEFAULT_BENAME, suffixes=[DEFAULT_SUFFIX], excludeSuffixes=[],
126 encrypt=False, repl_data=True, outputfile='/tmp/export_{}.ldif'.format(inst.serverid))
127 inst.start()
128
129 ds_replcheck_path = os.path.join(m1.ds_paths.bin_dir, 'ds-replcheck')
130
131 if ds_is_newer("1.4.1.2"):
132 replcheck_cmd = [[ds_replcheck_path, 'online', '-b', DEFAULT_SUFFIX, '-D', DN_DM, '-w', PW_DM, '-l', '1',
133 '-m', 'ldap://{}:{}'.format(m1.host, m1.port), '--conflicts',
134 '-r', 'ldap://{}:{}'.format(m2.host, m2.port)],
135 [ds_replcheck_path, 'online', '-b', DEFAULT_SUFFIX, '-D', DN_DM, '-w', PW_DM, '-l', '1',
136 '-m', 'ldaps://{}:{}'.format(m1.host, m1.sslport), '--conflicts',
137 '-r', 'ldaps://{}:{}'.format(m2.host, m2.sslport)],
138 [ds_replcheck_path, 'online', '-b', DEFAULT_SUFFIX, '-D', DN_DM, '-w', PW_DM, '-l', '1',
139 '-m', 'ldap://{}:{}'.format(m1.host, m1.port), '-Z', m1.get_ssca_dir(),
140 '-r', 'ldap://{}:{}'.format(m2.host, m2.port), '--conflicts'],
141 [ds_replcheck_path, 'online', '-b', DEFAULT_SUFFIX, '-D', DN_DM, '-w', PW_DM, '-l', '1',
142 '-m', 'ldapi://%2fvar%2frun%2fslapd-{}.socket'.format(m1.serverid), '--conflict',
143 '-r', 'ldapi://%2fvar%2frun%2fslapd-{}.socket'.format(m2.serverid)],
144 [ds_replcheck_path, 'offline', '-b', DEFAULT_SUFFIX, '--conflicts', '--rid', '1',
145 '-m', '/tmp/export_{}.ldif'.format(m1.serverid),
146 '-r', '/tmp/export_{}.ldif'.format(m2.serverid)]]
147 else:
148 replcheck_cmd = [[ds_replcheck_path, '-b', DEFAULT_SUFFIX, '-D', DN_DM, '-w', PW_DM, '-l', '1',
149 '-m', 'ldap://{}:{}'.format(m1.host, m1.port), '--conflicts',
150 '-r', 'ldap://{}:{}'.format(m2.host, m2.port)],
151 [ds_replcheck_path, '-b', DEFAULT_SUFFIX, '-D', DN_DM, '-w', PW_DM, '-l', '1',
152 '-m', 'ldaps://{}:{}'.format(m1.host, m1.sslport), '--conflicts',
153 '-r', 'ldaps://{}:{}'.format(m2.host, m2.sslport)],
154 [ds_replcheck_path, '-b', DEFAULT_SUFFIX, '-D', DN_DM, '-w', PW_DM, '-l', '1',
155 '-m', 'ldap://{}:{}'.format(m1.host, m1.port), '-Z', m1.get_ssca_dir(),
156 '-r', 'ldap://{}:{}'.format(m2.host, m2.port), '--conflicts'],
157 [ds_replcheck_path, '-b', DEFAULT_SUFFIX, '-D', DN_DM, '-w', PW_DM, '-l', '1',
158 '-m', 'ldapi://%2fvar%2frun%2fslapd-{}.socket'.format(m1.serverid), '--conflict',
159 '-r', 'ldapi://%2fvar%2frun%2fslapd-{}.socket'.format(m2.serverid)],
160 [ds_replcheck_path, '-b', DEFAULT_SUFFIX, '-D', DN_DM, '-w', PW_DM, '--conflicts',
161 '-M', '/tmp/export_{}.ldif'.format(m1.serverid),
162 '-R', '/tmp/export_{}.ldif'.format(m2.serverid)]]
163
164 return replcheck_cmd
165
166 @pytest.mark.skipif(ds_is_older("1.4.1.2"), reason="Not implemented")
167 def test_state(topo_tls_ldapi):
168 """Check "state" report
169
170 :id: 1cc6b28b-8a42-45fb-ab50-9552db0ac178
171 :customerscenario: True
172 :setup: Two supplier replication
173 :steps:
174 1. Get the replication state value
175 2. The state value is as expected
176 :expectedresults:
177 1. It should be successful
178 2. It should be successful
179 """
180 m1 = topo_tls_ldapi.ms["supplier1"]
181 m2 = topo_tls_ldapi.ms["supplier2"]
182 ds_replcheck_path = os.path.join(m1.ds_paths.bin_dir, 'ds-replcheck')
183
184 tool_cmd = [ds_replcheck_path, 'state', '-b', DEFAULT_SUFFIX, '-D', DN_DM, '-w', PW_DM,
185 '-m', 'ldaps://{}:{}'.format(m1.host, m1.sslport),
186 '-r', 'ldaps://{}:{}'.format(m2.host, m2.sslport)]
187 result = subprocess.check_output(tool_cmd, encoding='utf-8')
188 assert (result.rstrip() == "Replication State: Supplier and Replica are in perfect synchronization")
189
190
191 def test_check_ruv(topo_tls_ldapi):
192 """Check that the report has RUV
193
194 :id: 1cc6b28b-8a42-45fb-ab50-9552db0ac179
195 :customerscenario: True
196 :setup: Two supplier replication
197 :steps:
198 1. Get RUV from supplier and replica
199 2. Generate the report
200 3. Check that the RUV is mentioned in the report
201 :expectedresults:
202 1. It should be successful
203 2. It should be successful
204 3. The RUV should be mentioned in the report
205 """
206
207 m1 = topo_tls_ldapi.ms["supplier1"]
208
209 replicas_m1 = Replica(m1, DEFAULT_SUFFIX)
210 ruv_entries = replicas_m1.get_attr_vals_utf8('nsds50ruv')
211
212 for tool_cmd in replcheck_cmd_list(topo_tls_ldapi):
213 result = subprocess.check_output(tool_cmd, encoding='utf-8')
214 assert all([ruv_entry in result for ruv_entry in ruv_entries])
215
216
217 def test_missing_entries(topo_tls_ldapi):
218 """Check that the report has missing entries
219
220 :id: f91b6798-6e6e-420a-ad2f-3222bb908b7d
221 :customerscenario: True
222 :setup: Two supplier replication
223 :steps:
224 1. Pause replication between supplier and replica
225 2. Add two entries to supplier and two entries to replica
226 3. Generate the report
227 4. Check that the entries DN are mentioned in the report
228 :expectedresults:
229 1. It should be successful
230 2. It should be successful
231 3. It should be successful
232 4. The entries DN should be mentioned in the report
233 """
234
235 m1 = topo_tls_ldapi.ms["supplier1"]
236 m2 = topo_tls_ldapi.ms["supplier2"]
237
238 try:
239 topo_tls_ldapi.pause_all_replicas()
240 users_m1 = UserAccounts(m1, DEFAULT_SUFFIX)
241 user0 = users_m1.create_test_user(1000)
242 user1 = users_m1.create_test_user(1001)
243 users_m2 = UserAccounts(m2, DEFAULT_SUFFIX)
244 user2 = users_m2.create_test_user(1002)
245 user3 = users_m2.create_test_user(1003)
246
247 for tool_cmd in replcheck_cmd_list(topo_tls_ldapi):
248 result = subprocess.check_output(tool_cmd, encoding='utf-8').lower()
249 assert user0.dn.lower() in result
250 assert user1.dn.lower() in result
251 finally:
252 user0.delete()
253 user1.delete()
254 user2.delete()
255 user3.delete()
256 topo_tls_ldapi.resume_all_replicas()
257
258
259 def test_tombstones(topo_tls_ldapi):
260 """Check that the report mentions right number of tombstones
261
262 :id: bd27de78-0046-431c-8240-a93052df1cdc
263 :customerscenario: True
264 :setup: Two supplier replication
265 :steps:
266 1. Add an entry to supplier and wait for replication
267 2. Pause replication between supplier and replica
268 3. Delete the entry from supplier
269 4. Generate the report
270 5. Check that we have different number of tombstones in the report
271 :expectedresults:
272 1. It should be successful
273 2. It should be successful
274 3. It should be successful
275 4. It should be successful
276 5. It should be successful
277 """
278
279 m1 = topo_tls_ldapi.ms["supplier1"]
280
281 try:
282 users_m1 = UserAccounts(m1, DEFAULT_SUFFIX)
283 user_m1 = users_m1.create(properties=TEST_USER_PROPERTIES)
284 time.sleep(1)
285 topo_tls_ldapi.pause_all_replicas()
286 user_m1.delete()
287 time.sleep(2)
288
289 for tool_cmd in replcheck_cmd_list(topo_tls_ldapi):
290 result = subprocess.check_output(tool_cmd, encoding='utf-8').lower()
291 log.debug(result)
292 finally:
293 topo_tls_ldapi.resume_all_replicas()
294
295
296 def test_conflict_entries(topo_tls_ldapi):
297 """Check that the report has conflict entries
298
299 :id: 4eda0c5d-0824-4cfd-896e-845faf49ddaf
300 :customerscenario: True
301 :setup: Two supplier replication
302 :steps:
303 1. Pause replication between supplier and replica
304 2. Add two entries to supplier and two entries to replica
305 3. Delete first entry from supplier
306 4. Add a child to the first entry
307 5. Resume replication between supplier and replica
308 6. Generate the report
309 7. Check that the entries DN are mentioned in the report
310 :expectedresults:
311 1. It should be successful
312 2. It should be successful
313 3. It should be successful
314 4. It should be successful
315 5. It should be successful
316 6. It should be successful
317 7. The entries DN should be mentioned in the report
318 """
319
320 m1 = topo_tls_ldapi.ms["supplier1"]
321 m2 = topo_tls_ldapi.ms["supplier2"]
322
323 topo_tls_ldapi.pause_all_replicas()
324
325 _create_container(m1, DEFAULT_SUFFIX, 'conflict_parent0')
326 _create_container(m2, DEFAULT_SUFFIX, 'conflict_parent0')
327 cont_p_m1 = _create_container(m1, DEFAULT_SUFFIX, 'conflict_parent1')
328 cont_p_m2 = _create_container(m2, DEFAULT_SUFFIX, 'conflict_parent1')
329 _delete_container(cont_p_m1)
330 _create_container(m2, cont_p_m2.dn, 'conflict_child0')
331
332 topo_tls_ldapi.resume_all_replicas()
333 time.sleep(5)
334
335 for tool_cmd in replcheck_cmd_list(topo_tls_ldapi):
336 result = subprocess.check_output(tool_cmd, encoding='utf-8')
337 assert 'conflict_parent1' in result
338
339
340 def test_inconsistencies(topo_tls_ldapi):
341 """Check that the report mentions inconsistencies with attributes
342
343 :id: c8fe3e84-b346-4969-8f5d-3462b643a1d2
344 :customerscenario: True
345 :setup: Two supplier replication
346 :steps:
347 1. Add an entry to supplier and wait for replication
348 2. Pause replication between supplier and replica
349 3. Set different description attr values to supplier and replica
350 4. Add telephoneNumber attribute to supplier and not to replica
351 5. Generate the report
352 6. Check that attribute values are mentioned in the report
353 7. Generate the report with -i option to ignore some attributes
354 8. Check that attribute values are mentioned in the report
355 :expectedresults:
356 1. It should be successful
357 2. It should be successful
358 3. It should be successful
359 4. It should be successful
360 5. It should be successful
361 6. The attribute values should be mentioned in the report
362 7. It should be successful
363 8. The attribute values should not be mentioned in the report
364 """
365
366 m1 = topo_tls_ldapi.ms["supplier1"]
367 m2 = topo_tls_ldapi.ms["supplier2"]
368 attr_m1 = "m1_inconsistency"
369 attr_m2 = "m2_inconsistency"
370 attr_first = "first ordered valued"
371 attr_second = "second ordered valued"
372 attr_m1_only = "123123123"
373
374 try:
375 users_m1 = UserAccounts(m1, DEFAULT_SUFFIX)
376 users_m2 = UserAccounts(m2, DEFAULT_SUFFIX)
377 user_m1 = users_m1.create(properties=TEST_USER_PROPERTIES)
378 time.sleep(1)
379 user_m2 = users_m2.get(user_m1.rdn)
380 topo_tls_ldapi.pause_all_replicas()
381 user_m1.set("description", attr_m1)
382 user_m2.set("description", attr_m2)
383 user_m1.set("telephonenumber", attr_m1_only)
384 # Add the same multi-valued attrs, but out of order
385 user_m1.set("cn", [attr_first, attr_second])
386 user_m2.set("cn", [attr_second, attr_first])
387 time.sleep(2)
388
389 for tool_cmd in replcheck_cmd_list(topo_tls_ldapi):
390 result = subprocess.check_output(tool_cmd, encoding='utf-8').lower()
391 assert attr_m1 in result
392 assert attr_m2 in result
393 assert attr_m1_only in result
394 if ds_is_newer("1.3.9.1", "1.4.1.2"):
395 assert attr_first not in result
396 assert attr_second not in result
397 # Ignore some attributes and check the output
398 tool_cmd.extend(['-i', '{},{}'.format('description', 'telephonenumber')])
399 result = subprocess.check_output(tool_cmd, encoding='utf-8').lower()
400 assert attr_m1 not in result
401 assert attr_m2 not in result
402 assert attr_m1_only not in result
403 if ds_is_newer("1.3.9.1", "1.4.1.2"):
404 assert attr_first not in result
405 assert attr_second not in result
406
407 finally:
408 topo_tls_ldapi.resume_all_replicas()
409 user_m1.delete()
410
411
412 def test_suffix_exists(topo_tls_ldapi):
413 """Check if wrong suffix is provided, server is giving Error: Failed
414 to validate suffix.
415
416 :id: ce75debc-c07f-4e72-8787-8f99cbfaf1e2
417 :customerscenario: True
418 :setup: Two supplier replication
419 :steps:
420 1. Run ds-replcheck with wrong suffix (Non Existing)
421 :expectedresults:
422 1. It should be unsuccessful
423 """
424 m1 = topo_tls_ldapi.ms["supplier1"]
425 m2 = topo_tls_ldapi.ms["supplier2"]
426 ds_replcheck_path = os.path.join(m1.ds_paths.bin_dir, 'ds-replcheck')
427
428 if ds_is_newer("1.4.1.2"):
429 tool_cmd = [ds_replcheck_path, 'online', '-b', 'dc=test,dc=com', '-D', DN_DM, '-w', PW_DM,
430 '-m', 'ldaps://{}:{}'.format(m1.host, m1.sslport),
431 '-r', 'ldaps://{}:{}'.format(m2.host, m2.sslport)]
432 else:
433 tool_cmd = [ds_replcheck_path, '-b', 'dc=test,dc=com', '-D', DN_DM, '-w', PW_DM,
434 '-m', 'ldaps://{}:{}'.format(m1.host, m1.sslport),
435 '-r', 'ldaps://{}:{}'.format(m2.host, m2.sslport)]
436
437 result1 = subprocess.Popen(tool_cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, encoding='utf-8')
438 result = result1.communicate()
439 assert "Failed to validate suffix" in result[0]
440
441
442 def test_check_missing_tombstones(topo_tls_ldapi):
443 """Check missing tombstone entries is not reported.
444
445 :id: 93067a5a-416e-4243-9418-c4dfcf42e093
446 :customerscenario: True
447 :setup: Two supplier replication
448 :steps:
449 1. Pause replication between supplier and replica
450 2. Add and delete an entry on the supplier
451 3. Run ds-replcheck
452 4. Verify there are NO complaints about missing entries/tombstones
453 :expectedresults:
454 1. It should be successful
455 2. It should be successful
456 3. It should be successful
457 4. It should be successful
458 """
459 m1 = topo_tls_ldapi.ms["supplier1"]
460 m2 = topo_tls_ldapi.ms["supplier2"]
461
462 try:
463 topo_tls_ldapi.pause_all_replicas()
464 users_m1 = UserAccounts(m1, DEFAULT_SUFFIX)
465 user0 = users_m1.create_test_user(1000)
466 user0.delete()
467 for tool_cmd in replcheck_cmd_list(topo_tls_ldapi):
468 result = subprocess.check_output(tool_cmd, encoding='utf-8').lower()
469 assert "entries missing on replica" not in result
470
471 finally:
472 topo_tls_ldapi.resume_all_replicas()
473
474
475 def test_dsreplcheck_with_password_file(topo_tls_ldapi, tmpdir):
476 """Check ds-replcheck works if password file is provided
477 with -y option.
478
479 :id: 0d847ec7-6eaf-4cb5-a9c6-e4a5a1778f93
480 :customerscenario: True
481 :setup: Two supplier replication
482 :steps:
483 1. Create a password file with the default password of the server.
484 2. Run ds-replcheck with -y option (used to pass password file)
485 :expectedresults:
486 1. It should be successful
487 2. It should be successful
488 """
489 m1 = topo_tls_ldapi.ms["supplier1"]
490 m2 = topo_tls_ldapi.ms["supplier2"]
491
492 ds_replcheck_path = os.path.join(m1.ds_paths.bin_dir, 'ds-replcheck')
493 f = tmpdir.mkdir("my_dir").join("password_file.txt")
494 f.write(PW_DM)
495
496 if ds_is_newer("1.4.1.2"):
497 tool_cmd = [ds_replcheck_path, 'online', '-b', DEFAULT_SUFFIX, '-D', DN_DM, '-y', f.strpath,
498 '-m', 'ldaps://{}:{}'.format(m1.host, m1.sslport),
499 '-r', 'ldaps://{}:{}'.format(m2.host, m2.sslport)]
500 else:
501 tool_cmd = [ds_replcheck_path, '-b', DEFAULT_SUFFIX, '-D', DN_DM, '-y', f.strpath,
502 '-m', 'ldaps://{}:{}'.format(m1.host, m1.sslport),
503 '-r', 'ldaps://{}:{}'.format(m2.host, m2.sslport)]
504
505 subprocess.Popen(tool_cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, encoding='utf-8')
506
507
508 @pytest.mark.skipif(ds_is_older('1.4.1'), reason='Not implemented')
509 def test_dsreplcheck_timeout_connection_mechanisms(topo_tls_ldapi):
510 """Check that ds-replcheck timeout option works with various connection mechanisms
511
512 :id: aeeb99c9-09e2-45dc-bd75-9f95409babe7
513 :customerscenario: True
514 :setup: Two supplier replication
515 :steps:
516 1. Create two suppliers with various connection mechanisms configured
517 2. Run ds-replcheck with -t option
518 :expectedresults:
519 1. Success
520 2. Success
521 """
522
523 OUTPUT = 'Supplier and Replica are in perfect synchronization'
524
525 m1 = topo_tls_ldapi.ms["supplier1"]
526 m2 = topo_tls_ldapi.ms["supplier2"]
527
528 ds_replcheck_path = os.path.join(m1.ds_paths.bin_dir, 'ds-replcheck')
529
530 replcheck_cmd = [[ds_replcheck_path, 'online', '-b', DEFAULT_SUFFIX, '-D', DN_DM, '-w', PW_DM, '-l', '1',
531 '-m', 'ldap://{}:{}'.format(m1.host, m1.port), '--conflicts',
532 '-r', 'ldap://{}:{}'.format(m2.host, m2.port), '-t', '120'],
533 [ds_replcheck_path, 'online', '-b', DEFAULT_SUFFIX, '-D', DN_DM, '-w', PW_DM, '-l', '1',
534 '-m', 'ldaps://{}:{}'.format(m1.host, m1.sslport), '--conflicts',
535 '-r', 'ldaps://{}:{}'.format(m2.host, m2.sslport), '-t', '120'],
536 [ds_replcheck_path, 'online', '-b', DEFAULT_SUFFIX, '-D', DN_DM, '-w', PW_DM, '-l', '1',
537 '-m', 'ldap://{}:{}'.format(m1.host, m1.port), '-Z', m1.get_ssca_dir(),
538 '-r', 'ldap://{}:{}'.format(m2.host, m2.port), '--conflicts', '-t', '120'],
539 [ds_replcheck_path, 'online', '-b', DEFAULT_SUFFIX, '-D', DN_DM, '-w', PW_DM, '-l', '1',
540 '-m', 'ldapi://%2fvar%2frun%2fslapd-{}.socket'.format(m1.serverid), '--conflict',
541 '-r', 'ldapi://%2fvar%2frun%2fslapd-{}.socket'.format(m2.serverid), '-t', '120']]
542
543 log.info('Run ds-replcheck with -t option')
544 for connection in replcheck_cmd:
545 result = subprocess.check_output(connection)
546 assert OUTPUT in ensure_str(result)
547
548
549 if __name__ == '__main__':
550 # Run isolated
551 # -s for DEBUG mode
552 CURRENT_FILE = os.path.realpath(__file__)