From 4e99539bd1a82857882c7a14201dc07cdcb53980 Mon Sep 17 00:00:00 2001 From: Willem Kaufmann Date: Mon, 15 Jul 2024 16:05:59 -0400 Subject: [PATCH] redpanda/admin: remove `throw` statement in `start_handler` 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. --- src/v/redpanda/admin/server.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/v/redpanda/admin/server.cc b/src/v/redpanda/admin/server.cc index e9a69cbd5945..d165c4324b3d 100644 --- a/src/v/redpanda/admin/server.cc +++ b/src/v/redpanda/admin/server.cc @@ -2819,9 +2819,13 @@ admin_server::self_test_start_handler(std::unique_ptr 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 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 {