-
Notifications
You must be signed in to change notification settings - Fork 285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MultiDB]: throwing exception when database_config.json doesn't exist #319
Changes from 2 commits
9993672
727a538
cf3fac9
5c18e59
cc58463
1579a18
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,42 +53,44 @@ void SonicDBConfig::initialize(const string &file) | |
{ | ||
throw runtime_error("Sonic database config file syntax error >> " + string(e.what())); | ||
} | ||
} else { | ||
throw runtime_error("Sonic database config file doesn't exist at " + file); | ||
} | ||
} | ||
|
||
string SonicDBConfig::getDbInst(const string &dbName) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Add a unit test case for non existing dbName #Closed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. DONE. Added all five API test cases. |
||
{ | ||
if (!m_init) | ||
initialize(); | ||
return m_db_info[dbName].first; | ||
return m_db_info.at(dbName).first; | ||
} | ||
|
||
int SonicDBConfig::getDbId(const string &dbName) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Add a unit test case for non existing dbName #Closed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. DONE. Added all five API test cases. |
||
{ | ||
if (!m_init) | ||
initialize(); | ||
return m_db_info[dbName].second; | ||
return m_db_info.at(dbName).second; | ||
} | ||
|
||
string SonicDBConfig::getDbSock(const string &dbName) | ||
{ | ||
if (!m_init) | ||
initialize(); | ||
return m_inst_info[getDbInst(dbName)].first; | ||
return m_inst_info.at(getDbInst(dbName)).first; | ||
} | ||
|
||
string SonicDBConfig::getDbHostname(const string &dbName) | ||
{ | ||
if (!m_init) | ||
initialize(); | ||
return m_inst_info[getDbInst(dbName)].second.first; | ||
return m_inst_info.at(getDbInst(dbName)).second.first; | ||
} | ||
|
||
int SonicDBConfig::getDbPort(const string &dbName) | ||
{ | ||
if (!m_init) | ||
initialize(); | ||
return m_inst_info[getDbInst(dbName)].second.second; | ||
return m_inst_info.at(getDbInst(dbName)).second.second; | ||
} | ||
|
||
constexpr const char *SonicDBConfig::DEFAULT_SONIC_DB_CONFIG_FILE; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
follow code format nearby #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DONE