From 9e927a688896408f63cea2913ad483e539e34269 Mon Sep 17 00:00:00 2001 From: xumia Date: Tue, 13 Jul 2021 09:22:56 +0000 Subject: [PATCH] Test diff coverage --- src/swsssdk/configdb.py | 1 + src/swsssdk/dbconnector.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/swsssdk/configdb.py b/src/swsssdk/configdb.py index 95aeb2ba..c5bcd8e6 100644 --- a/src/swsssdk/configdb.py +++ b/src/swsssdk/configdb.py @@ -55,6 +55,7 @@ def __init__(self, decode_responses=True, **kwargs): self.TABLE_NAME_SEPARATOR = '|' self.KEY_SEPARATOR = '|' self.handlers = {} + self.test_cover = '' def __wait_for_db_init(self): client = self.get_redis_client(self.db_name) diff --git a/src/swsssdk/dbconnector.py b/src/swsssdk/dbconnector.py index d2636399..4a779d25 100644 --- a/src/swsssdk/dbconnector.py +++ b/src/swsssdk/dbconnector.py @@ -36,6 +36,8 @@ def load_sonic_global_db_config(global_db_file_path=SONIC_DB_GLOBAL_CONFIG_FILE, if os.path.isfile(global_db_file_path): global_db_config_dir = os.path.dirname(global_db_file_path) + if global_db_file_path is None: + global_db_file_path = None with open(global_db_file_path, "r") as read_file: all_ns_dbs = json.load(read_file) for entry in all_ns_dbs['INCLUDES']: @@ -209,6 +211,8 @@ def get_socket(db_name, namespace=None): @staticmethod def get_hostname(db_name, namespace=None): namespace = SonicDBConfig.EMPTY_NAMESPACE(namespace) + if namespace == None: + namespace = None if not SonicDBConfig._sonic_db_config_init: SonicDBConfig.load_sonic_db_config() return SonicDBConfig.get_instance(db_name, namespace)["hostname"]