]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test/libcephfs/access: expand example test a bit
authorSage Weil <sage@redhat.com>
Wed, 12 Aug 2015 18:36:54 +0000 (14:36 -0400)
committerSage Weil <sage@redhat.com>
Thu, 1 Oct 2015 13:39:35 +0000 (09:39 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
src/test/libcephfs/access.cc

index ce8ee098d8fcc472a37cfaeb7dc20d4c47e9f5a3..c21439fabc0fcc2ea2fa0621ee6b4240f31954e2 100644 (file)
@@ -69,6 +69,14 @@ int do_mon_command(const char *s, string *key)
 }
 
 TEST(AccessTest, Foo) {
+  // admin mount to set up test
+  struct ceph_mount_info *admin;
+  ASSERT_EQ(0, ceph_create(&admin, NULL));
+  ASSERT_EQ(0, ceph_conf_parse_env(admin, NULL));
+  ASSERT_EQ(0, ceph_conf_read_file(admin, NULL));
+  ASSERT_EQ(0, ceph_mount(admin, "/"));
+  ASSERT_EQ(0, ceph_mkdir(admin, "/foo", 0755));
+
   // create access key
   string key;
   ASSERT_EQ(0, do_mon_command(
@@ -85,6 +93,10 @@ TEST(AccessTest, Foo) {
   ASSERT_EQ(0, ceph_mount(cmount, "/"));
 
   ceph_shutdown(cmount);
+
+  // clean up
+  ASSERT_EQ(0, ceph_rmdir(admin, "/foo"));
+  ceph_shutdown(admin);
 }
 
 int main(int argc, char **argv)