From b14222855f420ce3ed8908d23af1e60040da0189 Mon Sep 17 00:00:00 2001 From: Mark Reynolds Date: Fri, 30 Jan 2015 14:28:16 -0500 Subject: [PATCH] Ticket 48020 - lib389 - need to reset args_instance with every DirSrv init Bug Description: When running multiple tests using py.test, the global dictionary "args_instance" is not reset. So settings from previous DirSrv instances are applied to the new instance of DirSrv(if not explicity set in the calling test). Fix Description: Reset "args_instance" when a DirSrv object is initialized. Also used "PW_DM" for sll the SER_ROOT_PW values. https://fedorahosted.org/389/ticket/48020 Reviewed by: ? --- lib389/__init__.py | 13 +++++++++++++ lib389/_constants.py | 8 +++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/lib389/__init__.py b/lib389/__init__.py index b3c4916..89d83c2 100644 --- a/lib389/__init__.py +++ b/lib389/__init__.py @@ -359,6 +359,19 @@ class DirSrv(SimpleLDAPObject): self.log = log self.timeout = timeout + # Reset the args (py.test reuses the args_instance for each test case) + args_instance[SER_DEPLOYED_DIR] = os.environ.get('PREFIX', None) + args_instance[SER_BACKUP_INST_DIR] = os.environ.get('BACKUPDIR', DEFAULT_BACKUPDIR) + args_instance[SER_ROOT_DN] = DN_DM + args_instance[SER_ROOT_PW] = PW_DM + args_instance[SER_HOST] = LOCALHOST + args_instance[SER_PORT] = DEFAULT_PORT + args_instance[SER_SECURE_PORT] = DEFAULT_SECURE_PORT + args_instance[SER_SERVERID_PROP] = "template" + args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX + args_instance[SER_USER_ID] = None + args_instance[SER_GROUP_ID] = None + self.__wrapmethods() self.__add_brookers__() diff --git a/lib389/_constants.py b/lib389/_constants.py index 1c549f7..9b96324 100644 --- a/lib389/_constants.py +++ b/lib389/_constants.py @@ -85,7 +85,6 @@ CONF_RUN_DIR = 'RUN_DIR' CONF_DS_ROOT = 'DS_ROOT' CONF_PRODUCT_NAME = 'PRODUCT_NAME' - DN_CONFIG = "cn=config" DN_PLUGIN = "cn=plugins,%s" % DN_CONFIG DN_MAPPING_TREE = "cn=mapping tree,%s" % DN_CONFIG @@ -175,13 +174,14 @@ LOG_PLUGIN, LOG_MICROSECONDS, LOG_ACL_SUMMARY) = [1 << x for x in (range(8) + range(11, 19))] + # # Constants for individual tests # SUFFIX = 'dc=example,dc=com' PASSWORD = 'password' -# Used for standalone topology +# Standalone topology - 10 instances HOST_STANDALONE = LOCALHOST PORT_STANDALONE = 31389 SERVERID_STANDALONE = 'standalone' @@ -323,7 +323,6 @@ PORT_HUB_10 = 50389 SERVERID_HUB_10 = 'hub_10' REPLICAID_HUB_10 = 65535 - HOST_CONSUMER_1 = LOCALHOST PORT_CONSUMER_1 = 61389 SERVERID_CONSUMER_1 = 'consumer_1' @@ -332,7 +331,6 @@ HOST_CONSUMER_2 = LOCALHOST PORT_CONSUMER_2 = 62389 SERVERID_CONSUMER_2 = 'consumer_2' - HOST_CONSUMER_3 = LOCALHOST PORT_CONSUMER_3 = 63389 SERVERID_CONSUMER_3 = 'consumer_3' @@ -413,7 +411,7 @@ args_instance = { SER_DEPLOYED_DIR: os.environ.get('PREFIX', None), SER_BACKUP_INST_DIR: os.environ.get('BACKUPDIR', DEFAULT_BACKUPDIR), SER_ROOT_DN: DN_DM, - SER_ROOT_PW: PASSWORD, + SER_ROOT_PW: PW_DM, SER_HOST: LOCALHOST, SER_PORT: DEFAULT_PORT, SER_SERVERID_PROP: "template", -- 1.9.3