diff options
author | Sage Weil <sage@inktank.com> | 2013-08-26 12:52:44 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-08-26 12:52:44 -0700 |
commit | f0805cb61fccf9ffaa905b8477a131b4d46379fa (patch) | |
tree | 65234d89353a7b440c836cb160a1180a7df4d929 | |
parent | 51fe5da99c6dfa94788bcc2bcc109028c06cf4ed (diff) | |
download | ceph-wip-6122.tar.gz |
test/librados/cmd.cc: tolerate thrashing on pg_command testswip-6122
We may get ENXIO (osd down) or ENOENT (pg dne (yet) on the target osd) if
there is thrashing going on.
Fixes: #6122
Signed-off-by: Sage Weil <sage@inktank.com>
-rw-r--r-- | src/test/librados/cmd.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/test/librados/cmd.cc b/src/test/librados/cmd.cc index 71343f2b908..a822f558e05 100644 --- a/src/test/librados/cmd.cc +++ b/src/test/librados/cmd.cc @@ -100,8 +100,9 @@ TEST(LibRadosCmd, PGCmd) { string pgid = stringify(poolid) + ".0"; cmd[0] = (char *)"asdfasdf"; - ASSERT_EQ(-22, rados_pg_command(cluster, pgid.c_str(), (const char **)cmd, 1, "", 0, &buf, &buflen, &st, &stlen)); - + // note: tolerate NXIO here in case the cluster is thrashing out underneath us. + r = rados_pg_command(cluster, pgid.c_str(), (const char **)cmd, 1, "", 0, &buf, &buflen, &st, &stlen); + ASSERT_TRUE(r == -22 || r == -ENXIO); // make sure the pg exists on the osd before we query it rados_ioctx_t io; @@ -114,7 +115,9 @@ TEST(LibRadosCmd, PGCmd) { string qstr = "{\"prefix\":\"pg\", \"cmd\":\"query\", \"pgid\":\"" + pgid + "\"}"; cmd[0] = (char *)qstr.c_str(); - ASSERT_EQ(0, rados_pg_command(cluster, pgid.c_str(), (const char **)cmd, 1, "", 0, &buf, &buflen, &st, &stlen)); + // note: tolerate ENOENT/ENXIO here if hte osd is thrashing out underneath us + r = rados_pg_command(cluster, pgid.c_str(), (const char **)cmd, 1, "", 0, &buf, &buflen, &st, &stlen); + ASSERT_TRUE(r == 0 || r == -ENOENT || r == -ENXIO); ASSERT_LT(0u, buflen); rados_buffer_free(buf); |