local url = os.getenv("MCP_HTTP_URL")
assert(url and url ~= "", "MCP_HTTP_URL must be set")
mcp.connect_http("logserver", url)
print("CONNECT_HTTP_OK")
local log_hits = 0
mcp.on_log("logserver", function(ev)
log_hits = log_hits + 1
assert(ev ~= nil, "ev must not be nil")
assert(ev.server ~= nil, "envelope server must not be nil")
assert(ev.level ~= nil, "envelope level must not be nil")
assert(ev.logger ~= nil, "envelope logger must not be nil (regression guard)")
assert(ev.data ~= nil, "envelope data must not be nil (regression guard)")
print("LOG_EV_OK")
end)
local r = mcp.call("logserver", "emit_log", {})
assert(r.ok == true, "emit_log call failed: " .. tostring(r.error))
print("CALL_OK")
std.task.sleep(300)
print(string.format("LOG_HITS=%d", log_hits))
assert(log_hits >= 1, "log_hits must be >= 1, got: " .. tostring(log_hits))
print("FIXTURE_DONE")