Merge pull request #542 from koic/fix_flaky_listen_keepalive_thread_assertion

Fix the flaky thread count assertion in the listen keepalive test
This commit is contained in:
Koichi ITO 2026-09-05 02:23:29 +09:00 • committed by GitHub
commit f706cc8a5e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -6307,10 +6307,13 @@ module MCP
end
test "listen keepalive is not started when the interval is nil" do
before = Thread.list.size
# The set of threads, not their count: `Thread.list` is process-wide, so a thread another test left running
# that finishes between the two samples moves the count in the direction this assertion does not care about.
# Only a thread that appears is evidence of a keepalive timer.
before = Thread.list
open_listen_stream(id: "listen-1", notifications: { toolsListChanged: true })
assert_equal before, Thread.list.size, "a nil interval must not spawn a keepalive thread"
assert_empty(Thread.list - before, "a nil interval must not spawn a keepalive thread")
end
test "listen_keepalive_interval rejects a non-positive value" do