Skip to content

Commit

Permalink
redpanda/admin: remove throw statement in start_handler
Browse files Browse the repository at this point in the history
This commit removes the `throw` statement in
`admin_server::self_test_start_handler()` and replaces it instead
with a `push_back()` to `self_test_request::unknown_checks`.

Eventually, these unknown checks will have a result displayed
when `rpk cluster self-test status` is invoked.

For the self-test, any unrecognized tests will be appended to
`start_test_request::unknown_checks`, so a future result from
`rpk cluster self-test status` will return a message indicating
an unknown test was skipped.
  • Loading branch information
WillemKauf committed Jul 30, 2024
1 parent 93b1901 commit 4e99539
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/v/redpanda/admin/server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2819,9 +2819,13 @@ admin_server::self_test_start_handler(std::unique_ptr<ss::http::request> req) {
} else if (test_type == "cloud") {
r.ctos.push_back(cluster::cloudcheck_opts::from_json(obj));
} else {
throw ss::httpd::bad_param_exception(
"Unknown self_test 'type', valid options are 'disk', "
"'network', or 'cloud'.");
rapidjson::StringBuffer buffer;
rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
element.Accept(writer);
r.unknown_checks.push_back(cluster::unknown_check{
.test_type = test_type,
.test_json = ss::sstring{
buffer.GetString(), buffer.GetSize()}});
}
}
} else {
Expand Down

0 comments on commit 4e99539

Please sign in to comment.