Skip to content

Commit

Permalink
cluster/self_test: use unknown_checks in backend/frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
WillemKauf committed Jul 30, 2024
1 parent aa93f3f commit 93b1901
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
16 changes: 14 additions & 2 deletions src/v/cluster/self_test_backend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ ss::future<> self_test_backend::stop() {
ss::future<std::vector<self_test_result>> self_test_backend::do_start_test(
std::vector<diskcheck_opts> dtos,
std::vector<netcheck_opts> ntos,
std::vector<cloudcheck_opts> ctos) {
std::vector<cloudcheck_opts> ctos,
std::vector<unknown_check> unknown_checks) {
auto gate_holder = _gate.hold();
std::vector<self_test_result> results;

Expand Down Expand Up @@ -150,6 +151,16 @@ ss::future<std::vector<self_test_result>> self_test_backend::do_start_test(
}
}

for (const auto& unknown_check : unknown_checks) {
results.push_back(self_test_result{
.name = "Unknown",
.test_type = unknown_check.test_type,
.error = fmt::format(
"Unknown test type {} requested on node {}",
unknown_check.test_type,
_self)});
}

co_return results;
}

Expand All @@ -165,7 +176,8 @@ get_status_response self_test_backend::start_test(start_test_request req) {
return do_start_test(
std::move(req.dtos),
std::move(req.ntos),
std::move(req.ctos))
std::move(req.ctos),
std::move(req.unknown_checks))
.then([this, id = req.id](auto results) {
for (auto& r : results) {
r.test_id = id;
Expand Down
3 changes: 2 additions & 1 deletion src/v/cluster/self_test_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ class self_test_backend {
ss::future<std::vector<self_test_result>> do_start_test(
std::vector<diskcheck_opts> dtos,
std::vector<netcheck_opts> ntos,
std::vector<cloudcheck_opts> ctos);
std::vector<cloudcheck_opts> ctos,
std::vector<unknown_check> unknown_checks);

struct previous_netcheck_entity {
static const inline model::node_id unassigned{-1};
Expand Down
7 changes: 5 additions & 2 deletions src/v/cluster/self_test_frontend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ ss::future<uuid_t> self_test_frontend::start_test(
if (ids.empty()) {
throw self_test_exception("No node ids provided");
}
if (req.dtos.empty() && req.ntos.empty() && req.ctos.empty()) {
if (
req.dtos.empty() && req.ntos.empty() && req.ctos.empty()
&& req.unknown_checks.empty()) {
throw self_test_exception("No tests specified to run");
}
/// Validate input
Expand Down Expand Up @@ -195,7 +197,8 @@ ss::future<uuid_t> self_test_frontend::start_test(
.id = test_id,
.dtos = std::move(req.dtos),
.ntos = std::move(new_ntos),
.ctos = std::move(req.ctos)});
.ctos = std::move(req.ctos),
.unknown_checks = std::move(req.unknown_checks)});
});
co_return test_id;
}
Expand Down

0 comments on commit 93b1901

Please sign in to comment.