Use temp folder for Env test sqlite files:

* Moved empty path check to DatabaseCon, and only for non-standalone.
* No more "DummyForUnitTest" files getting left behind in repo after running unit tests.
This commit is contained in:
Edward Hennis
2015-12-17 16:50:28 -08:00
committed by Vinnie Falco
parent 1320898fbe
commit 48e0466a2b
3 changed files with 7 additions and 2 deletions

View File

@@ -62,6 +62,11 @@ DatabaseCon::Setup setup_DatabaseCon (Config const& c)
setup.startUp = c.START_UP;
setup.standAlone = c.RUN_STANDALONE;
setup.dataDir = c.legacy ("database_path");
if (!setup.standAlone && setup.dataDir.empty())
{
Throw<std::runtime_error>(
"database_path must be set.");
}
return setup;
}

View File

@@ -38,7 +38,7 @@ getSociSqliteInit (std::string const& name,
std::string const& dir,
std::string const& ext)
{
if (dir.empty () || name.empty ())
if (name.empty ())
{
Throw<std::runtime_error> (
"Sqlite databases must specify a dir and a name. Name: " +

View File

@@ -59,7 +59,7 @@ setupConfigForUnitTests (Config& config)
config.overwrite (ConfigSection::nodeDatabase (), "path", "main");
config.deprecatedClearSection (ConfigSection::importNodeDatabase ());
config.legacy("database_path", "DummyForUnitTests");
config.legacy("database_path", "");
config.RUN_STANDALONE = true;
config["server"].append("port_peer");