summaryrefslogtreecommitdiff
path: root/netfs/unittests/testGlacier.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-07-15 00:57:14 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2015-07-19 15:47:56 +0100
commit8a0331d5a9d129ad9fc851eb58e4d30c434c544f (patch)
tree23fc27c2189e3b42cd301070b36145490b0d4329 /netfs/unittests/testGlacier.cpp
parentRefactor mocked fuse client into it's own files (diff)
downloadnetfs-8a0331d5a9d129ad9fc851eb58e4d30c434c544f.tar.bz2
netfs-8a0331d5a9d129ad9fc851eb58e4d30c434c544f.tar.xz
netfs-8a0331d5a9d129ad9fc851eb58e4d30c434c544f.zip
Classify test cases into their own files
Diffstat (limited to 'netfs/unittests/testGlacier.cpp')
-rw-r--r--netfs/unittests/testGlacier.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/netfs/unittests/testGlacier.cpp b/netfs/unittests/testGlacier.cpp
new file mode 100644
index 0000000..17f892a
--- /dev/null
+++ b/netfs/unittests/testGlacier.cpp
@@ -0,0 +1,41 @@
+#define BOOST_TEST_MODULE TestNetFSGlacier
+#include <boost/test/unit_test.hpp>
+#include "mockDaemon.h"
+#include "mockFuse.h"
+#include <boost/filesystem/path.hpp>
+#include <boost/scope_exit.hpp>
+
+#ifndef ROOT
+#error "ROOT needs to be defined at compilation time"
+#endif
+
+#define XSTR(s) STR(s)
+#define STR(s) #s
+const boost::filesystem::path RootDir(XSTR(ROOT));
+const std::string testEndpoint("tcp -h localhost -p 12013");
+
+BOOST_AUTO_TEST_CASE ( withRouter )
+{
+ BOOST_REQUIRE_EQUAL(0,
+ system("/usr/bin/glacier2router --Glacier2.Client.Endpoints='tcp -p 4063' --Glacier2.PermissionsVerifier=Glacier2/NullPermissionsVerifier --daemon --pidfile /tmp/glacier.pid"));
+ sleep(1);
+
+ BOOST_SCOPE_EXIT(void) {
+ system("kill $(cat /tmp/glacier.pid)");
+ } BOOST_SCOPE_EXIT_END;
+
+ {
+ char * glacierFuseArgv[] = {
+ strdup((RootDir / ":testvol").string().c_str()),
+ strdup((RootDir / "test").string().c_str()),
+ strdup("--Ice.Default.Router=Glacier2/router:tcp -h localhost -p 4063")
+ };
+
+ MockDaemonHost daemon(testEndpoint);
+ FuseMockHost fuse(testEndpoint, 3, glacierFuseArgv);
+
+ struct statvfs s;
+ BOOST_REQUIRE_EQUAL(0, fuse.fuse->statfs("/", &s));
+ }
+}
+