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:
commit
f706cc8a5e
1 changed files with 5 additions and 2 deletions
|
|
@ -6307,10 +6307,13 @@ module MCP
|
||||||
end
|
end
|
||||||
|
|
||||||
test "listen keepalive is not started when the interval is nil" do
|
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 })
|
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
|
end
|
||||||
|
|
||||||
test "listen_keepalive_interval rejects a non-positive value" do
|
test "listen_keepalive_interval rejects a non-positive value" do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue