]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librgw: reorg SETUP_ENUMERATE test
authorMatt Benjamin <mbenjamin@redhat.com>
Fri, 8 Jan 2016 19:39:50 +0000 (14:39 -0500)
committerMatt Benjamin <mbenjamin@redhat.com>
Fri, 12 Feb 2016 17:07:38 +0000 (12:07 -0500)
Stat nfsroot bucket, create it only if !exist && do_create.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
src/test/librgw_file_nfsns.cc

index e91e452af292aebcf31c61fc3a6fce210ecc1b6c..8e90dba80f1950333b11baa67aae6caf5e038b17 100644 (file)
@@ -123,7 +123,21 @@ TEST(LibRGW, MOUNT) {
 
 TEST(LibRGW, SETUP_ENUMERATE1)
 {
-  if (do_create) {
+
+  (void) rgw_lookup(fs, fs->root_fh, bucket_name.c_str(), &bucket_fh,
+                   RGW_LOOKUP_FLAG_NONE);
+  if (! bucket_fh) {
+    if (do_create) {
+      struct stat st;
+      int rc = rgw_mkdir(fs, fs->root_fh, bucket_name.c_str(), 755, &st,
+                        &bucket_fh);
+      ASSERT_EQ(rc, 0);
+    }
+  }
+
+  ASSERT_NE(bucket_fh, nullptr);
+  
+  if (do_create) {    
     /* create objects directly */
     std::vector<std::string> obj_names =
       {"foo/bar/baz/quux",
@@ -260,17 +274,6 @@ TEST(LibRGW, MARKER1_SETUP_BUCKET)
     struct stat st;
     int ret;
 
-    if (do_create) {
-      ret = rgw_mkdir(fs, fs->root_fh, bucket_name.c_str(), 755, &st,
-                     &bucket_fh);
-    }
-    if (! bucket_fh) {
-      ret = rgw_lookup(fs, fs->root_fh, bucket_name.c_str(), &bucket_fh,
-                      RGW_LOOKUP_FLAG_NONE);
-      ASSERT_EQ(ret, 0);
-    }
-    ASSERT_NE(bucket_fh, nullptr);
-
     if (do_create) {
       ret = rgw_mkdir(fs, bucket_fh, marker_dir.c_str(), 755, &st, &marker_fh);
     } else {