diff options
Diffstat (limited to '')
-rw-r--r-- | src/test/cli-integration/rbd/snap-diff.t | 4 | ||||
-rw-r--r-- | src/test/cli/rbd/help.t | 7 | ||||
-rw-r--r-- | src/test/client/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/test/client/commands.cc | 48 |
4 files changed, 57 insertions, 3 deletions
diff --git a/src/test/cli-integration/rbd/snap-diff.t b/src/test/cli-integration/rbd/snap-diff.t index 1ca2fb04d..fa564891a 100644 --- a/src/test/cli-integration/rbd/snap-diff.t +++ b/src/test/cli-integration/rbd/snap-diff.t @@ -39,10 +39,14 @@ $ rbd diff --from-snap=snap1 xrbddiff1/xtestdiff1 --format json [] $ rbd snap rollback xrbddiff1/xtestdiff1@snap1 --no-progress + $ rbd diff --from-snap=allzeroes xrbddiff1/xtestdiff1 --format json + [{"offset":0,"length":1048576,"exists":"true"}] $ rbd diff --from-snap=snap1 xrbddiff1/xtestdiff1 --format json [] $ rbd snap rollback xrbddiff1/xtestdiff1@allzeroes --no-progress $ rbd diff --from-snap=allzeroes xrbddiff1/xtestdiff1 --format json + [] + $ rbd diff --from-snap=snap1 xrbddiff1/xtestdiff1 --format json [{"offset":0,"length":1048576,"exists":"false"}] $ ceph osd pool rm xrbddiff1 xrbddiff1 --yes-i-really-really-mean-it pool 'xrbddiff1' removed diff --git a/src/test/cli/rbd/help.t b/src/test/cli/rbd/help.t index 8d8d30273..4e9b0cc1d 100644 --- a/src/test/cli/rbd/help.t +++ b/src/test/cli/rbd/help.t @@ -194,9 +194,9 @@ rbd help children usage: rbd children [--pool <pool>] [--namespace <namespace>] - [--image <image>] [--snap <snap>] [--snap-id <snap-id>] - [--all] [--descendants] [--format <format>] - [--pretty-format] + [--image <image>] [--snap <snap>] [--image-id <image-id>] + [--snap-id <snap-id>] [--all] [--descendants] + [--format <format>] [--pretty-format] <image-or-snap-spec> Display children of an image or its snapshot. @@ -211,6 +211,7 @@ --namespace arg namespace name --image arg image name --snap arg snapshot name + --image-id arg image id --snap-id arg snapshot id -a [ --all ] list all children (include trash) --descendants include all descendants diff --git a/src/test/client/CMakeLists.txt b/src/test/client/CMakeLists.txt index 1937bdd0b..3d3e327f3 100644 --- a/src/test/client/CMakeLists.txt +++ b/src/test/client/CMakeLists.txt @@ -3,6 +3,7 @@ if(${WITH_CEPHFS}) main.cc alternate_name.cc ops.cc + commands.cc ) target_link_libraries(ceph_test_client client diff --git a/src/test/client/commands.cc b/src/test/client/commands.cc new file mode 100644 index 000000000..c1fe76331 --- /dev/null +++ b/src/test/client/commands.cc @@ -0,0 +1,48 @@ +#include <errno.h> + +#include <iostream> +#include <string> +#include <vector> +#include <unordered_map> + +#include <fmt/format.h> + +#include "test/client/TestClient.h" + + +TEST_F(TestClient, SingleTargetMdsCommand) { + auto mds_spec = "a"; + auto cmd = "{\"prefix\": \"session ls\", \"format\": \"json\"}"; + bufferlist inbl; + bufferlist outbl; + std::string outs; + std::vector<std::string> cmdv; + C_SaferCond cond; + + cmdv.push_back(cmd); + int r = client->mds_command(mds_spec, cmdv, inbl, &outbl, &outs, &cond); + r = cond.wait(); + + std::cout << "SingleTargetMdsCommand: " << outbl.c_str() << std::endl; + + ASSERT_TRUE(r == 0 || r == -38); +} + +TEST_F(TestClient, MultiTargetMdsCommand) { + auto mds_spec = "*"; + auto cmd = "{\"prefix\": \"session ls\", \"format\": \"json\"}"; + bufferlist inbl; + bufferlist outbl; + std::string outs; + std::vector<std::string> cmdv; + C_SaferCond cond; + + cmdv.push_back(cmd); + std::cout << "MultiTargetMds: " << std::endl; + int r = client->mds_command(mds_spec, cmdv, inbl, &outbl, &outs, &cond); + r = cond.wait(); + + std::cout << "MultiTargetMdsCommand: " << outbl.c_str() << std::endl; + + ASSERT_TRUE(r == 0 || r == -38); +} |