feat(daemon,registry): list lowered actions and expose binary variant detail
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 2s
VoidBuildSystem CI / signing-openssl-gcc16 (push) Failing after 15s

This commit is contained in:
faumaray committed 2026-12-04 02:42:33 +03:00
1 parent 69d1a8d274
commit 34fe148eb4
10 files changed
+252 -3

No files matched your search

+1
View File
@@ -75,6 +75,7 @@ check_process(0 "Usage: vbs daemon info " "" daemon info --help)
check_process(0 "Usage: vbs daemon clean " "" daemon clean --help)
check_process(0 "Usage: vbs daemon target info .*--name" "" daemon target info --help)
check_process(0 "Usage: vbs daemon pack .*--output" "" daemon pack --help)
check_process(0 "Usage: vbs daemon actions .*--limit" "" daemon actions --help)
check_process(0 "Usage: vbs daemon ide wait .*--timeout-ms" "" daemon ide wait --help)
check_process(2 "" "missing subcommand for 'vbs daemon'" daemon)
+61
View File
@@ -1350,6 +1350,67 @@ void build(Void::Build::Project &project) {}
Void::Testing::expect(!bool_field(*invalid, "ok", true));
}
VOID_TEST(Daemon, actions_lists_lowered_actions) {
auto temp = Void::FileSystem::TempDir::open("vbs_daemon_");
Void::Testing::require(temp.has_value());
const auto options = make_options(temp->path());
{
std::ofstream descriptor{options.project_root / "build.cpp"};
descriptor << R"cpp(#include <Void/Build.hpp>
void build(Void::Build::Project &project) {
auto app = project.executable("app");
app.sources({"main.cpp"});
}
)cpp";
Void::Testing::require(descriptor.good());
}
{
std::ofstream source{options.project_root / "main.cpp"};
source << "int main() { return 0; }\n";
Void::Testing::require(source.good());
}
auto server = Void::Build::Daemon::DaemonServer::create(options);
Void::Testing::require(server.has_value());
const auto socket = server->socket_path();
Void::Result::Result<void, Void::Result::Error> run_result;
std::jthread worker{[&] { run_result = server->run(); }};
Void::Testing::require(wait_for_path(socket, std::chrono::seconds{5}));
auto listed =
request_object(socket, R"({"op":"actions","limit":5})", std::chrono::seconds{120});
auto filtered =
request_object(socket, R"({"op":"actions","target":"nope"})", std::chrono::seconds{120});
auto invalid = request_object(socket, R"({"op":"actions","limit":1001})");
auto shutdown = Void::Build::Daemon::request(socket, R"({"op":"shutdown"})");
Void::Testing::expect(shutdown.has_value());
worker.join();
Void::Testing::expect(run_result.has_value());
Void::Testing::require(listed.has_value());
Void::Testing::expect(bool_field(*listed, "ok"));
Void::Testing::expect(int_field(*listed, "total") >= 1);
Void::Testing::expect(int_field(*listed, "returned") <= 5);
const auto *actions = field(*listed, "actions");
Void::Testing::require(actions != nullptr);
const auto *action_array = std::get_if<JsonValue::Array>(&actions->value);
Void::Testing::require(action_array != nullptr && !action_array->empty());
const auto *first = std::get_if<JsonObject>(&action_array->front().value);
Void::Testing::require(first != nullptr);
Void::Testing::expect(!str_field(*first, "id").empty());
Void::Testing::expect(!str_field(*first, "target").empty());
Void::Testing::expect(!str_field(*first, "kind").empty());
Void::Testing::require(filtered.has_value());
Void::Testing::expect(bool_field(*filtered, "ok"));
Void::Testing::expect_eq(int_field(*filtered, "total"), std::int64_t{0});
Void::Testing::require(invalid.has_value());
Void::Testing::expect(!bool_field(*invalid, "ok", true));
}
VOID_TEST(Daemon, describe_empty_project_reports_zero_targets) {
auto temp = Void::FileSystem::TempDir::open("vbs_daemon_");
Void::Testing::require(temp.has_value());
+12
View File
@@ -620,6 +620,18 @@ VOID_TEST(RegistryTests, registry_binary_variant_publish_download_and_materializ
Void::Testing::expect(listed->body.find("\"yanked\":false") != std::string::npos);
}
auto binary_detail = send_loopback_http(port, "GET", binary_path);
Void::Testing::expect(binary_detail.has_value() && binary_detail->status == 200);
if (binary_detail) {
Void::Testing::expect(binary_detail->body.find("\"variant_id\":\"" + variant_id + "\"") !=
std::string::npos);
Void::Testing::expect(binary_detail->body.find("\"signature\":\"" + *signature + "\"") !=
std::string::npos);
Void::Testing::expect(binary_detail->body.find("\"download_url\":") != std::string::npos);
}
auto missing_binary = send_loopback_http(port, "GET", binary_path + "-missing");
Void::Testing::expect(missing_binary.has_value() && missing_binary->status == 404);
auto downloaded = send_loopback_http(port, "GET", binary_path + "/download");
Void::Testing::expect(downloaded.has_value() && downloaded->status == 200);
if (downloaded) {