feat: filter daemon actions by kind; show registry release detail
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 5s
VoidBuildSystem CI / signing-openssl-gcc16 (push) Failing after 9s

This commit is contained in:
faumaray committed 2026-12-04 04:50:12 +03:00
1 parent 624016d904
commit 691560a369
11 files changed
+228 -21

No files matched your search

+2
View File
@@ -51,6 +51,8 @@ check_process(0 "Usage: vbs binaries <command>.*Commands:.*list.*fetch" "" binar
check_process(0 "Usage: vbs binaries list " "" binaries list --help)
check_process(0 "Usage: vbs releases list " "" releases list --help)
check_process(2 "" "--registry and --name are required" releases list)
check_process(0 "Usage: vbs releases show " "" releases show --help)
check_process(2 "" "--registry, --name, and --version are required" releases show)
check_process(0 "Usage: vbs binaries fetch " "" binaries fetch --help)
check_process(2 "" "--registry, --name, and --version are required" binaries list)
check_process(2 "" "--variant and --output are required" binaries fetch --registry http://127.0.0.1:1 --name p --version 1.0.0)
+25 -2
View File
@@ -1460,8 +1460,13 @@ void build(Void::Build::Project &project) {
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 filtered = request_object(socket, R"({"op":"actions","target":"nope"})",
std::chrono::seconds{120});
auto by_kind = request_object(socket, R"({"op":"actions","kind":"link"})",
std::chrono::seconds{120});
auto unknown_kind = request_object(socket, R"({"op":"actions","kind":"nope"})",
std::chrono::seconds{120});
auto invalid_kind = request_object(socket, R"({"op":"actions","kind":5})");
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());
@@ -1485,6 +1490,24 @@ void build(Void::Build::Project &project) {
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(by_kind.has_value());
Void::Testing::expect(bool_field(*by_kind, "ok"));
Void::Testing::expect(int_field(*by_kind, "total") >= 1);
const auto *kind_actions = field(*by_kind, "actions");
Void::Testing::require(kind_actions != nullptr);
const auto *kind_array = std::get_if<JsonValue::Array>(&kind_actions->value);
Void::Testing::require(kind_array != nullptr);
for (const auto &item : *kind_array) {
const auto *entry = std::get_if<JsonObject>(&item.value);
Void::Testing::require(entry != nullptr);
Void::Testing::expect_eq(str_field(*entry, "kind"), std::string{"link"});
}
Void::Testing::require(unknown_kind.has_value());
Void::Testing::expect_eq(int_field(*unknown_kind, "total"), std::int64_t{0});
Void::Testing::require(invalid_kind.has_value());
Void::Testing::expect(!bool_field(*invalid_kind, "ok", true));
Void::Testing::require(invalid.has_value());
Void::Testing::expect(!bool_field(*invalid, "ok", true));
}
+35
View File
@@ -1176,6 +1176,41 @@ target_include_directories(hello_pkg PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include
Void::Testing::expect(releases_res->stdout_data.find("active") != std::string::npos);
}
// `vbs releases show` prints the release detail fetched from the live registry.
std::string release_sha;
if (r2) {
const auto sha_pos = r2->stdout_data.find("sha256=");
if (sha_pos != std::string::npos) {
release_sha = r2->stdout_data.substr(sha_pos + 7, 64);
}
}
Void::Testing::expect(!release_sha.empty());
Platform::ProcessRequest releases_show;
releases_show.executable = vbs_bin;
releases_show.arguments = {"releases", "show", "--registry", reg_url,
"--name", "hello-pkg", "--version", "1.1.0"};
releases_show.environment.set_vars["VBS_REGISTRY_TOKEN"] = *tok;
auto releases_show_res = Platform::run_supervised(releases_show);
Void::Testing::expect(releases_show_res.has_value() && releases_show_res->succeeded());
if (releases_show_res) {
Void::Testing::expect(releases_show_res->stdout_data.find("version=1.1.0") !=
std::string::npos);
if (!release_sha.empty()) {
Void::Testing::expect(releases_show_res->stdout_data.find("sha256=" + release_sha) !=
std::string::npos);
}
Void::Testing::expect(releases_show_res->stdout_data.find("binaries=") !=
std::string::npos);
}
// An unknown release version fails instead of printing a bogus detail line.
Platform::ProcessRequest releases_show_missing = releases_show;
releases_show_missing.arguments.back() = "9.9.9";
auto releases_show_missing_res = Platform::run_supervised(releases_show_missing);
Void::Testing::expect(releases_show_missing_res.has_value() &&
!releases_show_missing_res->succeeded());
// 2. Create a consumer project declaring `.package("hello-pkg", "^1.0").registry(reg_url)`.
const auto cons_dir = tmp / "consumer";
const auto cons_build = tmp / "consumer_build";