summaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
Diffstat (limited to 'unittests')
-rw-r--r--unittests/config.cpp37
-rw-r--r--unittests/mockDefs.cpp2
-rw-r--r--unittests/service.cpp4
3 files changed, 36 insertions, 7 deletions
diff --git a/unittests/config.cpp b/unittests/config.cpp
index 0cfc22c..460a35f 100644
--- a/unittests/config.cpp
+++ b/unittests/config.cpp
@@ -16,10 +16,10 @@ class IdsIce : public IceTray::DryIce {
public:
IdsIce(const char * uid, const char * gid) : IceTray::DryIce({
"--GitFS.testrepo.gitdir=%?"_fmt(rootDir.string()),
- "--GitFS.testrepo.authkey=%?"_fmt("testauth"),
- "--GitFS.testrepo.gid=%?"_fmt(gid),
- "--GitFS.testrepo.uid=%?"_fmt(uid),
- "--GitFS.testrepo.commit=7a0ccb40084c3ab31d9856e7f689c0514c28c930",
+ "--GitFS.testrepo.authkey=%?"_fmt("testauth"),
+ "--GitFS.testrepo.gid=%?"_fmt(gid),
+ "--GitFS.testrepo.uid=%?"_fmt(uid),
+ "--GitFS.testrepo.commitish=7a0ccb40084c3ab31d9856e7f689c0514c28c930",
})
{}
};
@@ -30,6 +30,13 @@ const auto DIRS = btdata::make({ "/", "/src", "/unittests/fixtures" });
const auto FILES = btdata::make({
"/Jamroot.jam", "/src/repo.cpp", "/unittests/fixtures/executable" });
const auto LINKS = btdata::make({ "/unittests/fixtures/symlink" });
+const auto COMMITISHS = btdata::make({
+ "",
+ "master",
+ "origin/master",
+ "testcommit",
+ "7a0ccb40084c3ab31d9856e7f689c0514c28c930"
+});
BOOST_DATA_TEST_CASE(uid_gid_override_getattr,
USERS * GROUPS * (DIRS + FILES + LINKS),
@@ -78,4 +85,26 @@ BOOST_DATA_TEST_CASE(uid_gid_override_list,
dir->close();
}
+BOOST_DATA_TEST_CASE(commitishs, COMMITISHS * (FILES + DIRS), commitish, path)
+{
+ IceTray::DryIce di({
+ "--GitFS.testrepo.gitdir=%?"_fmt(rootDir.string()),
+ "--GitFS.testrepo.authkey=%?"_fmt("testauth"),
+ "--GitFS.testrepo.commitish=%?"_fmt(commitish),
+ });
+ VolumeClient c;
+ BOOST_CHECK_NO_THROW(c.v->ice_ping());
+ BOOST_CHECK_NO_THROW(c.v->getattr(c.env, path));
+}
+
+BOOST_DATA_TEST_CASE(bad_commitishs, FILES, commitish) // File paths aren't commitishs
+{
+ IceTray::DryIce di({
+ "--GitFS.testrepo.gitdir=%?"_fmt(rootDir.string()),
+ "--GitFS.testrepo.authkey=%?"_fmt("testauth"),
+ "--GitFS.testrepo.commitish=%?"_fmt(commitish),
+ });
+ Client c;
+ BOOST_CHECK_THROW(c.s->connect("testrepo", "testauth"), NetFS::ConfigError);
+}
diff --git a/unittests/mockDefs.cpp b/unittests/mockDefs.cpp
index dff4cbc..1ecf11c 100644
--- a/unittests/mockDefs.cpp
+++ b/unittests/mockDefs.cpp
@@ -9,7 +9,7 @@ GitFS::Test::Service::Service() :
IceTray::DryIce({
"--GitFS.testrepo.gitdir=%?"_fmt(rootDir.string()),
"--GitFS.testrepo.authkey=testauth",
- "--GitFS.testrepo.commit=7a0ccb40084c3ab31d9856e7f689c0514c28c930",
+ "--GitFS.testrepo.commitish=7a0ccb40084c3ab31d9856e7f689c0514c28c930",
})
{
}
diff --git a/unittests/service.cpp b/unittests/service.cpp
index aaa9d85..207aa15 100644
--- a/unittests/service.cpp
+++ b/unittests/service.cpp
@@ -31,7 +31,7 @@ BOOST_DATA_TEST_CASE(badauth,
IceTray::DryIce s({
"--GitFS.testrepo.gitdir=%?"_fmt(rootDir.string()),
"--GitFS.testrepo.authkey=testauth",
- "--GitFS.testrepo.commit=7a0ccb40084c3ab31d9856e7f689c0514c28c930",
+ "--GitFS.testrepo.commitish=7a0ccb40084c3ab31d9856e7f689c0514c28c930",
});
Client c;
BOOST_CHECK_NO_THROW(c.s->ice_ping());
@@ -45,7 +45,7 @@ BOOST_AUTO_TEST_CASE(missing_repo)
"--GitFS.missing.gitdir=/not/here",
"--GitFS.missing.commit=7a0ccb40084c3ab31d9856e7f689c0514c28c930",
"--GitFS.testrepo.gitdir=%?"_fmt(rootDir.string()),
- "--GitFS.testrepo.commit=7a0ccb40084c3ab31d9856e7f689c0514c28c931",
+ "--GitFS.testrepo.commitish=7a0ccb40084c3ab31d9856e7f689c0514c28c931",
});
Client c;
BOOST_CHECK_NO_THROW(c.s->ice_ping());