summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorMatt Benjamin <mbenjamin@redhat.com>2021-01-05 22:08:02 +0100
committerMatt Benjamin <mbenjamin@redhat.com>2021-01-25 22:46:25 +0100
commite6d54e7d7914a68fe0311b14202b25ec1a97b708 (patch)
tree7d4f895b13f388a90415ea472cc70e71da8caf85 /src/test
parentqa/rgw: librgw workunit creates a test user (diff)
downloadceph-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')
-rw-r--r--src/test/librgw_file_aw.cc2
-rw-r--r--src/test/librgw_file_cd.cc2
-rw-r--r--src/test/librgw_file_gp.cc25
-rw-r--r--src/test/librgw_file_nfsns.cc2
4 files changed, 27 insertions, 4 deletions
diff --git a/src/test/librgw_file_aw.cc b/src/test/librgw_file_aw.cc
index fc494fe5a00..1dfe9f1d1a8 100644
--- a/src/test/librgw_file_aw.cc
+++ b/src/test/librgw_file_aw.cc
@@ -47,7 +47,7 @@ namespace {
bool do_verify = false;
bool do_hexdump = false;
- string bucket_name = "sorry_dave";
+ string bucket_name = "sorrydave";
string object_name = "jocaml";
struct rgw_file_handle *bucket_fh = nullptr;
diff --git a/src/test/librgw_file_cd.cc b/src/test/librgw_file_cd.cc
index c4edecafc39..ff0bd1fbde2 100644
--- a/src/test/librgw_file_cd.cc
+++ b/src/test/librgw_file_cd.cc
@@ -41,7 +41,7 @@ namespace {
bool do_multi = false;
int multi_cnt = 10;
- string bucket_name = "sorry_dave";
+ string bucket_name = "sorrydave";
struct {
int argc;
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;
diff --git a/src/test/librgw_file_nfsns.cc b/src/test/librgw_file_nfsns.cc
index ecc3198c021..bc4c0a4a251 100644
--- a/src/test/librgw_file_nfsns.cc
+++ b/src/test/librgw_file_nfsns.cc
@@ -520,7 +520,7 @@ TEST(LibRGW, RGW_SETUP_RENAME1) {
st.st_mode = 755;
for (int b_ix : {0, 1}) {
- std::string bname{"brename_" + to_string(b_ix)};
+ std::string bname{"brename" + to_string(b_ix)};
obj_rec brec{bname, nullptr, nullptr, nullptr};
(void) rgw_lookup(fs, fs->root_fh, brec.name.c_str(), &brec.fh,
nullptr, 0, RGW_LOOKUP_FLAG_NONE);