feat(worker): run a continuous queue loop
This commit is contained in:
1 parent
4f3701c740
commit
8dac19c3ea
5 files changed
+139
-70
No files matched your search
@@ -2151,6 +2151,25 @@ VOID_TEST(RegistryTests, worker_cli_leases_publishes_and_reports_result) {
|
||||
if (queue_state) {
|
||||
Void::Testing::expect(queue_state->body.find("\"pending\":[]") != std::string::npos);
|
||||
}
|
||||
|
||||
// Continuous loop: process every queued action (record from the local state) and exit
|
||||
// when the queue drains.
|
||||
auto enqueued_again = send_loopback_http(port, "POST", "/api/v1/queue", auth,
|
||||
"{\"action_keys\":[\"" + action_key + "\"]}");
|
||||
Void::Testing::expect(enqueued_again.has_value() && enqueued_again->status == 200);
|
||||
Platform::ProcessRequest loop_worker = worker;
|
||||
loop_worker.arguments = {
|
||||
"worker", "--registry", reg_url, "--build-dir", (tmp / "build").string(), "--queue"};
|
||||
auto loop_res = Platform::run_supervised(loop_worker);
|
||||
Void::Testing::expect_eq(loop_res ? (loop_res->succeeded()
|
||||
? std::string{}
|
||||
: (loop_res->stdout_data + loop_res->stderr_data))
|
||||
: loop_res.error().message(),
|
||||
std::string{});
|
||||
if (loop_res) {
|
||||
Void::Testing::expect(loop_res->stdout_data.find("queue empty") != std::string::npos);
|
||||
Void::Testing::expect(loop_res->stdout_data.find(action_key) != std::string::npos);
|
||||
}
|
||||
(*svc)->stop_http();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user