summaryrefslogtreecommitdiffstats
path: root/src/test/librgw_file_gp.cc
diff options
context:
space:
mode:
authorMatt Benjamin <mbenjamin@redhat.com>2015-11-10 17:40:43 +0100
committerMatt Benjamin <mbenjamin@redhat.com>2016-02-12 18:05:53 +0100
commit6db1f9dd799739898e8d8f73380e99161a2886a1 (patch)
tree6ebb762f532872c54dce98df6bed7c4e1dc1cf14 /src/test/librgw_file_gp.cc
parentlibrgw: fix many rgw_file return codes (diff)
downloadceph-6db1f9dd799739898e8d8f73380e99161a2886a1.tar.xz
ceph-6db1f9dd799739898e8d8f73380e99161a2886a1.zip
librgw: fix size computation in RGWStatObjRequest
Overrides RGWGetObj::execute(), calls the parent method and then saves obj_size from the manifest. 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.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/test/librgw_file_gp.cc b/src/test/librgw_file_gp.cc
index f35503e2519..dcc44737ce1 100644
--- a/src/test/librgw_file_gp.cc
+++ b/src/test/librgw_file_gp.cc
@@ -45,6 +45,7 @@ namespace {
bool do_verify = false;
bool do_get = false;
bool do_delete = false;
+ bool do_stat = false; // stat objects (not buckets)
bool do_hexdump = false;
bool object_open = false;
@@ -217,7 +218,7 @@ TEST(LibRGW, LIST_OBJECTS) {
}
TEST(LibRGW, LOOKUP_OBJECT) {
- if (do_get || do_put || do_bulk || do_readv || do_writev) {
+ if (do_get || do_stat || do_put || do_bulk || do_readv || do_writev) {
int ret = rgw_lookup(fs, bucket_fh, object_name.c_str(), &object_fh,
RGW_LOOKUP_FLAG_CREATE);
ASSERT_EQ(ret, 0);
@@ -260,6 +261,16 @@ TEST(LibRGW, GET_OBJECT) {
}
}
+TEST(LibRGW, STAT_OBJECT) {
+ if (do_stat) {
+ struct stat st;
+ int ret = rgw_getattr(fs, object_fh, &st);
+ ASSERT_EQ(ret, 0);
+ dout(15) << "rgw_getattr on " << object_name << " size = "
+ << st.st_size << dendl;
+ }
+}
+
TEST(LibRGW, WRITE_READ_VERIFY)
{
if (do_bulk && do_put) {
@@ -424,6 +435,9 @@ int main(int argc, char *argv[])
} else if (ceph_argparse_flag(args, arg_iter, "--get",
(char*) nullptr)) {
do_get = true;
+ } else if (ceph_argparse_flag(args, arg_iter, "--stat",
+ (char*) nullptr)) {
+ do_stat = true;
} else if (ceph_argparse_flag(args, arg_iter, "--put",
(char*) nullptr)) {
do_put = true;