This is an automated email from the ASF dual-hosted git repository. alexey pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/kudu.git
commit 42425c044078a904089f360b0fd5e0c81d88dc2d Author: Alexey Serbin <[email protected]> AuthorDate: Fri Nov 27 21:23:56 2020 -0800 [tools] add missing top-level entries into TestModeHelp This patch adds missing entries into the ToolTest.TestModeHelp scenario for the existing top-level commands of the kudu CLI tool, extending the coverage of the scenario to all currently existing top-level kudu CLI commands. I also did a minor clean-up on the code: rearranged the entries in the scenario's code to match the sequence of those in the output of the tool when run with no arguments or with --help flag. Change-Id: I04c6744429e7a6a87ed6e87c1f5cab9c67d0f327 Reviewed-on: http://gerrit.cloudera.org:8080/16790 Tested-by: Alexey Serbin <[email protected]> Reviewed-by: Grant Henke <[email protected]> --- src/kudu/tools/kudu-tool-test.cc | 81 +++++++++++++++++++---------------- src/kudu/tools/tool_action_master.cc | 2 +- src/kudu/tools/tool_action_tserver.cc | 3 +- 3 files changed, 46 insertions(+), 40 deletions(-) diff --git a/src/kudu/tools/kudu-tool-test.cc b/src/kudu/tools/kudu-tool-test.cc index ab24435..31f25ef 100644 --- a/src/kudu/tools/kudu-tool-test.cc +++ b/src/kudu/tools/kudu-tool-test.cc @@ -984,16 +984,17 @@ TEST_F(ToolTest, TestTopLevelHelp) { TEST_F(ToolTest, TestModeHelp) { { - const vector<string> kFsModeRegexes = { - "check.*Check metadata consistency", - "downgrade.*Downgrade the metadata", - "fix.*Fix automatically-repairable metadata", - "list.*List the Kudu table HMS entries", - "precheck.*Check that the Kudu cluster is prepared", + const vector<string> kClusterModeRegexes = { + "ksck.*Check the health of a Kudu cluster", + "rebalance.*Move tablet replicas between tablet servers", }; - NO_FATALS(RunTestHelp("hms", kFsModeRegexes)); - NO_FATALS(RunTestHelp("hms not_a_mode", kFsModeRegexes, - Status::InvalidArgument("unknown command 'not_a_mode'"))); + NO_FATALS(RunTestHelp("cluster", kClusterModeRegexes)); + } + { + const vector<string> kDiagnoseModeRegexes = { + "parse_stacks.*Parse sampled stack traces", + }; + NO_FATALS(RunTestHelp("diagnose", kDiagnoseModeRegexes)); } { const vector<string> kFsModeRegexes = { @@ -1012,19 +1013,31 @@ TEST_F(ToolTest, TestModeHelp) { "block.*binary contents of a data block", "cfile.*contents of a CFile", "tree.*tree of a Kudu filesystem", - "uuid.*UUID of a Kudu filesystem" + "uuid.*UUID of a Kudu filesystem", }; NO_FATALS(RunTestHelp("fs dump", kFsDumpModeRegexes)); } { + const vector<string> kHmsModeRegexes = { + "check.*Check metadata consistency", + "downgrade.*Downgrade the metadata", + "fix.*Fix automatically-repairable metadata", + "list.*List the Kudu table HMS entries", + "precheck.*Check that the Kudu cluster is prepared", + }; + NO_FATALS(RunTestHelp("hms", kHmsModeRegexes)); + NO_FATALS(RunTestHelp("hms not_a_mode", kHmsModeRegexes, + Status::InvalidArgument("unknown command 'not_a_mode'"))); + } + { const vector<string> kLocalReplicaModeRegexes = { "cmeta.*Operate on a local tablet replica's consensus", "data_size.*Summarize the data size", "dump.*Dump a Kudu filesystem", "copy_from_remote.*Copy a tablet replica", "delete.*Delete tablet replicas from the local filesystem", - "list.*Show list of tablet replicas" + "list.*Show list of tablet replicas", }; NO_FATALS(RunTestHelp("local_replica", kLocalReplicaModeRegexes)); } @@ -1034,7 +1047,7 @@ TEST_F(ToolTest, TestModeHelp) { "data_dirs.*Dump the data directories", "meta.*Dump the metadata", "rowset.*Dump the rowset contents", - "wals.*Dump all WAL" + "wals.*Dump all WAL", }; NO_FATALS(RunTestHelp("local_replica dump", kLocalReplicaDumpModeRegexes)); } @@ -1042,7 +1055,7 @@ TEST_F(ToolTest, TestModeHelp) { const vector<string> kLocalReplicaCMetaRegexes = { "print_replica_uuids.*Print all tablet replica peer UUIDs", "rewrite_raft_config.*Rewrite a tablet replica", - "set_term.*Bump the current term" + "set_term.*Bump the current term", }; NO_FATALS(RunTestHelp("local_replica cmeta", kLocalReplicaCMetaRegexes)); // Try with a hyphen instead of an underscore. @@ -1050,7 +1063,7 @@ TEST_F(ToolTest, TestModeHelp) { } { const vector<string> kLocalReplicaCopyFromRemoteRegexes = { - "Copy a tablet replica from a remote server" + "Copy a tablet replica from a remote server", }; NO_FATALS(RunTestHelp("local_replica copy_from_remote --help", kLocalReplicaCopyFromRemoteRegexes)); @@ -1059,22 +1072,11 @@ TEST_F(ToolTest, TestModeHelp) { kLocalReplicaCopyFromRemoteRegexes)); } { - const vector<string> kClusterModeRegexes = { - "ksck.*Check the health of a Kudu cluster", - }; - NO_FATALS(RunTestHelp("cluster", kClusterModeRegexes)); - } - { - const vector<string> kDiagnoseModeRegexes = { - "parse_stacks.*Parse sampled stack traces", - }; - NO_FATALS(RunTestHelp("diagnose", kDiagnoseModeRegexes)); - } - { const vector<string> kMasterModeRegexes = { "authz_cache.*Operate on the authz caches of the Kudu Masters", "dump_memtrackers.*Dump the memtrackers", "get_flags.*Get the gflags", + "run.*Run a Kudu Master", "set_flag.*Change a gflag value", "status.*Get the status", "timestamp.*Get the current timestamp", @@ -1091,6 +1093,7 @@ TEST_F(ToolTest, TestModeHelp) { { const vector<string> kPbcModeRegexes = { "dump.*Dump a PBC", + "edit.*Edit a PBC \\(protobuf container\\) file", }; NO_FATALS(RunTestHelp("pbc", kPbcModeRegexes)); } @@ -1098,7 +1101,7 @@ TEST_F(ToolTest, TestModeHelp) { const vector<string> kPerfRegexes = { "loadgen.*Run load generation with optional scan afterwards", "table_scan.*Show row count and scanning time cost of tablets in a table", - "tablet_scan.*Show row count of a local tablet" + "tablet_scan.*Show row count of a local tablet", }; NO_FATALS(RunTestHelp("perf", kPerfRegexes)); } @@ -1109,7 +1112,7 @@ TEST_F(ToolTest, TestModeHelp) { "delete.*Delete a tablet replica", "dump.*Dump the data of a tablet replica", "list.*List all tablet replicas", - "unsafe_change_config.*Force the specified replica to adopt" + "unsafe_change_config.*Force the specified replica to adopt", }; NO_FATALS(RunTestHelp("remote_replica", kRemoteReplicaModeRegexes)); } @@ -1135,42 +1138,44 @@ TEST_F(ToolTest, TestModeHelp) { "rename_table.*Rename a table", "scan.*Scan rows from a table", "set_extra_config.*Change a extra configuration value on a table", - "statistics.*Get table statistics" + "statistics.*Get table statistics", }; NO_FATALS(RunTestHelp("table", kTableModeRegexes)); } { const vector<string> kTabletModeRegexes = { "change_config.*Change.*Raft configuration", - "leader_step_down.*Change.*tablet's leader" + "leader_step_down.*Change.*tablet's leader", + "unsafe_replace_tablet.*Replace a tablet with an empty one", }; NO_FATALS(RunTestHelp("tablet", kTabletModeRegexes)); } { - const vector<string> kTestModeRegexes = { - "mini_cluster.*Spawn a control shell" - }; - NO_FATALS(RunTestHelp("test", kTestModeRegexes)); - } - { const vector<string> kChangeConfigModeRegexes = { "add_replica.*Add a new replica", "change_replica_type.*Change the type of an existing replica", "move_replica.*Move a tablet replica", - "remove_replica.*Remove an existing replica" + "remove_replica.*Remove an existing replica", }; NO_FATALS(RunTestHelp("tablet change_config", kChangeConfigModeRegexes)); } { + const vector<string> kTestModeRegexes = { + "mini_cluster.*Spawn a control shell" + }; + NO_FATALS(RunTestHelp("test", kTestModeRegexes)); + } + { const vector<string> kTServerModeRegexes = { "dump_memtrackers.*Dump the memtrackers", "get_flags.*Get the gflags", "set_flag.*Change a gflag value", + "run.*Run a Kudu Tablet Server", "state.*Operate on the state", "status.*Get the status", "quiesce.*Operate on the quiescing state", "timestamp.*Get the current timestamp", - "list.*List tablet servers" + "list.*List tablet servers", }; NO_FATALS(RunTestHelp("tserver", kTServerModeRegexes)); } diff --git a/src/kudu/tools/tool_action_master.cc b/src/kudu/tools/tool_action_master.cc index 05a2d75..d50e0a9 100644 --- a/src/kudu/tools/tool_action_master.cc +++ b/src/kudu/tools/tool_action_master.cc @@ -370,7 +370,7 @@ unique_ptr<Mode> BuildMasterMode() { unique_ptr<Action> run = ActionBuilder("run", &MasterRun) .ProgramName("kudu-master") - .Description("Runs a Kudu Master") + .Description("Run a Kudu Master") .ExtraDescription("Note: The master server is started in this process and " "runs until interrupted.\n\n" "The most common configuration flags are described below. " diff --git a/src/kudu/tools/tool_action_tserver.cc b/src/kudu/tools/tool_action_tserver.cc index 3c85bd2..0ea95a6 100644 --- a/src/kudu/tools/tool_action_tserver.cc +++ b/src/kudu/tools/tool_action_tserver.cc @@ -37,6 +37,7 @@ #include "kudu/gutil/strings/substitute.h" #include "kudu/master/master.pb.h" #include "kudu/master/master.proxy.h" +#include "kudu/rpc/response_callback.h" #include "kudu/rpc/rpc_controller.h" #include "kudu/tools/tool_action.h" #include "kudu/tools/tool_action_common.h" @@ -323,7 +324,7 @@ unique_ptr<Mode> BuildTServerMode() { unique_ptr<Action> run = ActionBuilder("run", &TServerRun) .ProgramName("kudu-tserver") - .Description("Runs a Kudu Tablet Server") + .Description("Run a Kudu Tablet Server") .ExtraDescription("Note: The tablet server is started in this process and " "runs until interrupted.\n\n" "The most common configuration flags are described below. "
