|
|
be9751 |
From 48b30739f33d1eb526dbdd45c820129c4a4c4bcb Mon Sep 17 00:00:00 2001
|
|
|
be9751 |
From: progier389 <72748589+progier389@users.noreply.github.com>
|
|
|
be9751 |
Date: Tue, 12 Jan 2021 11:06:24 +0100
|
|
|
be9751 |
Subject: [PATCH] Issue 4504 - Insure ldapi is enabled in repl_monitor_test.py
|
|
|
be9751 |
(Needed on RHEL) (#4527)
|
|
|
be9751 |
|
|
|
be9751 |
(cherry picked from commit 279556bc78ed743d7a053069621d999ec045866f)
|
|
|
be9751 |
---
|
|
|
be9751 |
.../tests/suites/clu/repl_monitor_test.py | 67 +++++++++----------
|
|
|
be9751 |
1 file changed, 31 insertions(+), 36 deletions(-)
|
|
|
be9751 |
|
|
|
be9751 |
diff --git a/dirsrvtests/tests/suites/clu/repl_monitor_test.py b/dirsrvtests/tests/suites/clu/repl_monitor_test.py
|
|
|
be9751 |
index eb18d2da2..b2cb840b3 100644
|
|
|
be9751 |
--- a/dirsrvtests/tests/suites/clu/repl_monitor_test.py
|
|
|
be9751 |
+++ b/dirsrvtests/tests/suites/clu/repl_monitor_test.py
|
|
|
be9751 |
@@ -9,7 +9,6 @@
|
|
|
be9751 |
import time
|
|
|
be9751 |
import subprocess
|
|
|
be9751 |
import pytest
|
|
|
be9751 |
-import re
|
|
|
be9751 |
|
|
|
be9751 |
from lib389.cli_conf.replication import get_repl_monitor_info
|
|
|
be9751 |
from lib389.tasks import *
|
|
|
be9751 |
@@ -18,6 +17,8 @@ from lib389.topologies import topology_m2
|
|
|
be9751 |
from lib389.cli_base import FakeArgs
|
|
|
be9751 |
from lib389.cli_base.dsrc import dsrc_arg_concat
|
|
|
be9751 |
from lib389.cli_base import connect_instance
|
|
|
be9751 |
+from lib389.replica import Replicas
|
|
|
be9751 |
+
|
|
|
be9751 |
|
|
|
be9751 |
pytestmark = pytest.mark.tier0
|
|
|
be9751 |
|
|
|
be9751 |
@@ -68,25 +69,6 @@ def check_value_in_log_and_reset(content_list, second_list=None, single_value=No
|
|
|
be9751 |
log.info('Reset log file')
|
|
|
be9751 |
f.truncate(0)
|
|
|
be9751 |
|
|
|
be9751 |
-def get_hostnames_from_log(port1, port2):
|
|
|
be9751 |
- # Get the supplier host names as displayed in replication monitor output
|
|
|
be9751 |
- with open(LOG_FILE, 'r') as logfile:
|
|
|
be9751 |
- logtext = logfile.read()
|
|
|
be9751 |
- # search for Supplier :hostname:port
|
|
|
be9751 |
- # and use \D to insure there is no more number is after
|
|
|
be9751 |
- # the matched port (i.e that 10 is not matching 101)
|
|
|
be9751 |
- regexp = '(Supplier: )([^:]*)(:' + str(port1) + '\D)'
|
|
|
be9751 |
- match=re.search(regexp, logtext)
|
|
|
be9751 |
- host_m1 = 'localhost.localdomain'
|
|
|
be9751 |
- if (match is not None):
|
|
|
be9751 |
- host_m1 = match.group(2)
|
|
|
be9751 |
- # Same for master 2
|
|
|
be9751 |
- regexp = '(Supplier: )([^:]*)(:' + str(port2) + '\D)'
|
|
|
be9751 |
- match=re.search(regexp, logtext)
|
|
|
be9751 |
- host_m2 = 'localhost.localdomain'
|
|
|
be9751 |
- if (match is not None):
|
|
|
be9751 |
- host_m2 = match.group(2)
|
|
|
be9751 |
- return (host_m1, host_m2)
|
|
|
be9751 |
|
|
|
be9751 |
@pytest.mark.ds50545
|
|
|
be9751 |
@pytest.mark.bz1739718
|
|
|
be9751 |
@@ -115,6 +97,24 @@ def test_dsconf_replication_monitor(topology_m2, set_log_file):
|
|
|
be9751 |
m1 = topology_m2.ms["master1"]
|
|
|
be9751 |
m2 = topology_m2.ms["master2"]
|
|
|
be9751 |
|
|
|
be9751 |
+ # Enable ldapi if not already done.
|
|
|
be9751 |
+ for inst in [topology_m2.ms["master1"], topology_m2.ms["master2"]]:
|
|
|
be9751 |
+ if not inst.can_autobind():
|
|
|
be9751 |
+ # Update ns-slapd instance
|
|
|
be9751 |
+ inst.config.set('nsslapd-ldapilisten', 'on')
|
|
|
be9751 |
+ inst.config.set('nsslapd-ldapiautobind', 'on')
|
|
|
be9751 |
+ inst.restart()
|
|
|
be9751 |
+ # Ensure that updates have been sent both ways.
|
|
|
be9751 |
+ replicas = Replicas(m1)
|
|
|
be9751 |
+ replica = replicas.get(DEFAULT_SUFFIX)
|
|
|
be9751 |
+ replica.test_replication([m2])
|
|
|
be9751 |
+ replicas = Replicas(m2)
|
|
|
be9751 |
+ replica = replicas.get(DEFAULT_SUFFIX)
|
|
|
be9751 |
+ replica.test_replication([m1])
|
|
|
be9751 |
+
|
|
|
be9751 |
+ alias_content = ['Supplier: M1 (' + m1.host + ':' + str(m1.port) + ')',
|
|
|
be9751 |
+ 'Supplier: M2 (' + m2.host + ':' + str(m2.port) + ')']
|
|
|
be9751 |
+
|
|
|
be9751 |
connection_content = 'Supplier: '+ m1.host + ':' + str(m1.port)
|
|
|
be9751 |
content_list = ['Replica Root: dc=example,dc=com',
|
|
|
be9751 |
'Replica ID: 1',
|
|
|
be9751 |
@@ -177,9 +177,20 @@ def test_dsconf_replication_monitor(topology_m2, set_log_file):
|
|
|
be9751 |
'001',
|
|
|
be9751 |
m1.host + ':' + str(m1.port)]
|
|
|
be9751 |
|
|
|
be9751 |
+ dsrc_content = '[repl-monitor-connections]\n' \
|
|
|
be9751 |
+ 'connection1 = ' + m1.host + ':' + str(m1.port) + ':' + DN_DM + ':' + PW_DM + '\n' \
|
|
|
be9751 |
+ 'connection2 = ' + m2.host + ':' + str(m2.port) + ':' + DN_DM + ':' + PW_DM + '\n' \
|
|
|
be9751 |
+ '\n' \
|
|
|
be9751 |
+ '[repl-monitor-aliases]\n' \
|
|
|
be9751 |
+ 'M1 = ' + m1.host + ':' + str(m1.port) + '\n' \
|
|
|
be9751 |
+ 'M2 = ' + m2.host + ':' + str(m2.port)
|
|
|
be9751 |
+
|
|
|
be9751 |
connections = [m1.host + ':' + str(m1.port) + ':' + DN_DM + ':' + PW_DM,
|
|
|
be9751 |
m2.host + ':' + str(m2.port) + ':' + DN_DM + ':' + PW_DM]
|
|
|
be9751 |
|
|
|
be9751 |
+ aliases = ['M1=' + m1.host + ':' + str(m1.port),
|
|
|
be9751 |
+ 'M2=' + m2.host + ':' + str(m2.port)]
|
|
|
be9751 |
+
|
|
|
be9751 |
args = FakeArgs()
|
|
|
be9751 |
args.connections = connections
|
|
|
be9751 |
args.aliases = None
|
|
|
be9751 |
@@ -187,24 +198,8 @@ def test_dsconf_replication_monitor(topology_m2, set_log_file):
|
|
|
be9751 |
|
|
|
be9751 |
log.info('Run replication monitor with connections option')
|
|
|
be9751 |
get_repl_monitor_info(m1, DEFAULT_SUFFIX, log, args)
|
|
|
be9751 |
- (host_m1, host_m2) = get_hostnames_from_log(m1.port, m2.port)
|
|
|
be9751 |
check_value_in_log_and_reset(content_list, connection_content, error_list=error_list)
|
|
|
be9751 |
|
|
|
be9751 |
- # Prepare the data for next tests
|
|
|
be9751 |
- aliases = ['M1=' + host_m1 + ':' + str(m1.port),
|
|
|
be9751 |
- 'M2=' + host_m2 + ':' + str(m2.port)]
|
|
|
be9751 |
-
|
|
|
be9751 |
- alias_content = ['Supplier: M1 (' + host_m1 + ':' + str(m1.port) + ')',
|
|
|
be9751 |
- 'Supplier: M2 (' + host_m2 + ':' + str(m2.port) + ')']
|
|
|
be9751 |
-
|
|
|
be9751 |
- dsrc_content = '[repl-monitor-connections]\n' \
|
|
|
be9751 |
- 'connection1 = ' + m1.host + ':' + str(m1.port) + ':' + DN_DM + ':' + PW_DM + '\n' \
|
|
|
be9751 |
- 'connection2 = ' + m2.host + ':' + str(m2.port) + ':' + DN_DM + ':' + PW_DM + '\n' \
|
|
|
be9751 |
- '\n' \
|
|
|
be9751 |
- '[repl-monitor-aliases]\n' \
|
|
|
be9751 |
- 'M1 = ' + host_m1 + ':' + str(m1.port) + '\n' \
|
|
|
be9751 |
- 'M2 = ' + host_m2 + ':' + str(m2.port)
|
|
|
be9751 |
-
|
|
|
be9751 |
log.info('Run replication monitor with aliases option')
|
|
|
be9751 |
args.aliases = aliases
|
|
|
be9751 |
get_repl_monitor_info(m1, DEFAULT_SUFFIX, log, args)
|
|
|
be9751 |
--
|
|
|
be9751 |
2.26.2
|
|
|
be9751 |
|