summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--netfs/unittests/Jamfile.jam6
-rw-r--r--netfs/unittests/defaultDaemon.xml11
-rw-r--r--netfs/unittests/mockDaemon.cpp18
-rw-r--r--netfs/unittests/testCore.cpp4
-rw-r--r--netfs/unittests/testEdgeCases.cpp4
-rw-r--r--netfs/unittests/testGlacier.cpp4
6 files changed, 32 insertions, 15 deletions
diff --git a/netfs/unittests/Jamfile.jam b/netfs/unittests/Jamfile.jam
index 79f77e3..8811d27 100644
--- a/netfs/unittests/Jamfile.jam
+++ b/netfs/unittests/Jamfile.jam
@@ -27,21 +27,21 @@ lib testMocks :
run testCore.cpp
- : : :
+ : : defaultDaemon.xml :
<define>BOOST_TEST_DYN_LINK
<library>boost_utf
<library>testMocks
: testCore ;
run testGlacier.cpp
- : : :
+ : : defaultDaemon.xml :
<define>BOOST_TEST_DYN_LINK
<library>boost_utf
<library>testMocks
: testGlacier ;
run testEdgeCases.cpp
- : : :
+ : : defaultDaemon.xml :
<define>BOOST_TEST_DYN_LINK
<library>boost_utf
<library>testMocks
diff --git a/netfs/unittests/defaultDaemon.xml b/netfs/unittests/defaultDaemon.xml
new file mode 100644
index 0000000..76711cc
--- /dev/null
+++ b/netfs/unittests/defaultDaemon.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="ascii"?>
+<config>
+ <exports>
+ <export>
+ <name>testvol</name>
+ <export>
+ <root>/overridden</root>
+ </export>
+ </export>
+ </exports>
+</config>
diff --git a/netfs/unittests/mockDaemon.cpp b/netfs/unittests/mockDaemon.cpp
index 4a735e8..fa8c1a0 100644
--- a/netfs/unittests/mockDaemon.cpp
+++ b/netfs/unittests/mockDaemon.cpp
@@ -17,15 +17,14 @@ MockDaemon::MockDaemon(const std::string & ep) :
}
NetFS::Daemon::ConfigurationPtr
-MockDaemon::ReadConfiguration(const boost::filesystem::path &) const
+MockDaemon::ReadConfiguration(const boost::filesystem::path & path) const
{
- return new NetFS::Daemon::Configuration(
- {
- { "testvol", new NetFS::Daemon::Export(TestExportRoot.string()) }
- },
- {
- { "unittest", new NetFS::Daemon::Host(testEndpoint) }
- });
+ auto c = NetFSDaemon::ReadConfiguration(path);
+ for(auto e : c->Exports) {
+ e.second->RootPath = TestExportRoot.string();
+ }
+ c->Hosts.insert({ "unittest", new NetFS::Daemon::Host(testEndpoint) });
+ return c;
}
MockDaemonHost::MockDaemonHost(const std::string & ep, const Ice::StringSeq & ps) :
@@ -59,7 +58,8 @@ MockDaemonHost::stop()
void
MockDaemonHost::start()
{
- ic = Ice::initialize(params);
+ ic = Ice::initialize();
+ ic->getProperties()->parseCommandLineOptions("NetFSD", params);
ic->getProperties()->setProperty("NetFSD.HostNameOverride", "unittest");
daemon = new MockDaemon(testEndpoint);
daemon->start("NetFSDaemonAdapter", ic, {});
diff --git a/netfs/unittests/testCore.cpp b/netfs/unittests/testCore.cpp
index 75d55a4..af03ed3 100644
--- a/netfs/unittests/testCore.cpp
+++ b/netfs/unittests/testCore.cpp
@@ -21,7 +21,9 @@ char * defaultFuseArgv[] = {
class Core {
public:
Core() :
- daemonHost(testEndpoint),
+ daemonHost(testEndpoint, {
+ "--NetFSD.ConfigPath=" + (RootDir / "defaultDaemon.xml").string()
+ }),
fuseHost(testEndpoint, 2, defaultFuseArgv),
ic(daemonHost.ic),
fuse(fuseHost.fuse)
diff --git a/netfs/unittests/testEdgeCases.cpp b/netfs/unittests/testEdgeCases.cpp
index afa2338..3955e73 100644
--- a/netfs/unittests/testEdgeCases.cpp
+++ b/netfs/unittests/testEdgeCases.cpp
@@ -20,7 +20,9 @@ char * defaultFuseArgv[] = {
BOOST_AUTO_TEST_CASE ( createAndDaemonRestart )
{
- MockDaemonHost daemon(testEndpoint);
+ MockDaemonHost daemon(testEndpoint, {
+ "--NetFSD.ConfigPath=" + (RootDir / "defaultDaemon.xml").string()
+ });
FuseMockHost fuse(testEndpoint, 2, defaultFuseArgv);
struct statvfs s;
diff --git a/netfs/unittests/testGlacier.cpp b/netfs/unittests/testGlacier.cpp
index 17f892a..abe8a1e 100644
--- a/netfs/unittests/testGlacier.cpp
+++ b/netfs/unittests/testGlacier.cpp
@@ -31,7 +31,9 @@ BOOST_AUTO_TEST_CASE ( withRouter )
strdup("--Ice.Default.Router=Glacier2/router:tcp -h localhost -p 4063")
};
- MockDaemonHost daemon(testEndpoint);
+ MockDaemonHost daemon(testEndpoint, {
+ "--NetFSD.ConfigPath=" + (RootDir / "defaultDaemon.xml").string()
+ });
FuseMockHost fuse(testEndpoint, 3, glacierFuseArgv);
struct statvfs s;