diff options
author | Matt Benjamin <mbenjamin@redhat.com> | 2021-01-05 22:08:02 +0100 |
---|---|---|
committer | Matt Benjamin <mbenjamin@redhat.com> | 2021-01-25 22:46:25 +0100 |
commit | e6d54e7d7914a68fe0311b14202b25ec1a97b708 (patch) | |
tree | 7d4f895b13f388a90415ea472cc70e71da8caf85 /src/test/librgw_file_gp.cc | |
parent | qa/rgw: librgw workunit creates a test user (diff) | |
download | ceph-e6d54e7d7914a68fe0311b14202b25ec1a97b708.tar.xz ceph-e6d54e7d7914a68fe0311b14202b25ec1a97b708.zip |
rgw_file: add librgw unit test arguments
Also adjust some unit test files to avoid trivial failures.
Fixes missing commit after rgw_write(), as well as conditional
cleanup.
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
Diffstat (limited to 'src/test/librgw_file_gp.cc')
-rw-r--r-- | src/test/librgw_file_gp.cc | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/test/librgw_file_gp.cc b/src/test/librgw_file_gp.cc index c274a82706f..bde68fb4b9e 100644 --- a/src/test/librgw_file_gp.cc +++ b/src/test/librgw_file_gp.cc @@ -44,13 +44,18 @@ namespace { bool do_readv = false; bool do_verify = false; bool do_get = false; + bool do_create = false; bool do_delete = false; bool do_stat = false; // stat objects (not buckets) bool do_hexdump = false; bool object_open = false; - string bucket_name = "sorry_dave"; + uint32_t owner_uid = 867; + uint32_t owner_gid = 5309; + uint32_t create_mask = RGW_SETATTR_UID | RGW_SETATTR_GID | RGW_SETATTR_MODE; + + string bucket_name = "blastoff"; string object_name = "jocaml"; struct rgw_file_handle *bucket_fh = nullptr; @@ -184,6 +189,21 @@ TEST(LibRGW, MOUNT) { ASSERT_NE(fs, nullptr); } +TEST(LibRGW, CREATE_BUCKET) { + if (do_create) { + struct stat st; + struct rgw_file_handle *fh; + + st.st_uid = owner_uid; + st.st_gid = owner_gid; + st.st_mode = 755; + + int ret = rgw_mkdir(fs, fs->root_fh, bucket_name.c_str(), &st, create_mask, + &fh, RGW_MKDIR_FLAG_NONE); + ASSERT_EQ(ret, 0); + } +} + TEST(LibRGW, LOOKUP_BUCKET) { int ret = rgw_lookup(fs, fs->root_fh, bucket_name.c_str(), &bucket_fh, nullptr, 0, RGW_LOOKUP_FLAG_NONE); @@ -474,6 +494,9 @@ int main(int argc, char *argv[]) } else if (ceph_argparse_flag(args, arg_iter, "--prelist", (char*) nullptr)) { do_pre_list = true; + } else if (ceph_argparse_flag(args, arg_iter, "--create", + (char*) nullptr)) { + do_create = true; } else if (ceph_argparse_flag(args, arg_iter, "--hexdump", (char*) nullptr)) { do_hexdump = true; |