feat(daemon,registry): filter watch events by prefix; answer OPTIONS
This commit is contained in:
1 parent
e7698a411d
commit
e61eff7a8f
9 files changed
+208
-11
No files matched your search
+12
-1
@@ -704,8 +704,19 @@ VOID_TEST(Daemon, watch_poll_reports_changed_paths) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds{50});
|
||||
|
||||
bool saw_probe = false;
|
||||
bool non_matching_prefix_seen = false;
|
||||
for (int attempt = 0; attempt < 100 && !saw_probe; ++attempt) {
|
||||
auto poll = request_object(socket, R"({"op":"watch_poll"})");
|
||||
if (!non_matching_prefix_seen) {
|
||||
// A non-matching prefix must not consume the buffered event.
|
||||
auto non_matching = request_object(
|
||||
socket, R"({"op":"watch_poll","prefix":"/nonexistent-prefix/"})");
|
||||
Void::Testing::require(non_matching.has_value());
|
||||
Void::Testing::expect(string_array_field(*non_matching, "changed").empty());
|
||||
non_matching_prefix_seen = true;
|
||||
}
|
||||
auto poll = request_object(
|
||||
socket, std::format(R"({{"op":"watch_poll","prefix":{}}})",
|
||||
Void::Build::Util::json_quote(options.project_root.string())));
|
||||
Void::Testing::require(poll.has_value());
|
||||
for (const auto &path : string_array_field(*poll, "changed")) {
|
||||
if (path.find("probe.txt") != std::string::npos) {
|
||||
|
||||
Reference in new issue
Block a user