Skip to content

Commit

Permalink
cluster/self_test: add unknown_check
Browse files Browse the repository at this point in the history
For logging purposes, when an unrecognized test type is requested
through the `self_test_start_handler`, it will be abstracted by
the `unknown_check` struct.
  • Loading branch information
WillemKauf committed Jul 30, 2024
1 parent e3ca304 commit aa93f3f
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/v/cluster/self_test_rpc_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,26 @@ struct cloudcheck_opts
}
};

// Captures unknown test types passed to self test frontend for logging
// purposes.
struct unknown_check
: serde::
envelope<unknown_check, serde::version<0>, serde::compat_version<0>> {
ss::sstring test_type;
ss::sstring test_json;
auto serde_fields() { return std::tie(test_type, test_json); }

friend std::ostream&
operator<<(std::ostream& o, const unknown_check& unknown_check) {
fmt::print(
o,
"{{test_type: {}, test_json: {}}}",
unknown_check.test_type,
unknown_check.test_json);
return o;
}
};

struct self_test_result
: serde::
envelope<self_test_result, serde::version<1>, serde::compat_version<1>> {
Expand Down Expand Up @@ -300,14 +320,15 @@ struct empty_request
struct start_test_request
: serde::envelope<
start_test_request,
serde::version<0>,
serde::version<1>,
serde::compat_version<0>> {
using rpc_adl_exempt = std::true_type;

uuid_t id;
std::vector<diskcheck_opts> dtos;
std::vector<netcheck_opts> ntos;
std::vector<cloudcheck_opts> ctos;
std::vector<unknown_check> unknown_checks;

friend std::ostream&
operator<<(std::ostream& o, const start_test_request& r) {
Expand All @@ -321,6 +342,9 @@ struct start_test_request
for (const auto& v : r.ctos) {
fmt::print(ss, "cloudcheck_opts: {}", v);
}
for (const auto& v : r.unknown_checks) {
fmt::print(ss, "unknown_check: {}", v);
}
fmt::print(o, "{{id: {} {}}}", r.id, ss.str());
return o;
}
Expand Down

0 comments on commit aa93f3f

Please sign in to comment.