Skip to content

Commit 162481e

Browse files
committed
Add test for memory dump.
1 parent 4b70e6b commit 162481e

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

test/async/container/supervisor.rb

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,30 @@ def to_json(...)
2323
client = Async::Container::Supervisor::Client.new(instance, endpoint)
2424
connection = client.connect
2525

26+
# Wait for the client to connect to the server:
2627
sleep(0.001) until registration_monitor.registrations.any?
2728

28-
registration = registration_monitor.registrations.first
29-
expect(registration.state).to have_keys(
29+
connection = registration_monitor.registrations.first
30+
expect(connection.state).to have_keys(
3031
process_id: be == ::Process.pid
3132
)
3233
end
34+
35+
with "do_memory_dump" do
36+
it "can dump memory" do
37+
instance = FakeInstance.new
38+
client = Async::Container::Supervisor::Client.new(instance, endpoint)
39+
client_task = client.run
40+
41+
sleep(0.001) until registration_monitor.registrations.any?
42+
43+
path = File.join(@root, "memory.json")
44+
connection = registration_monitor.registrations.first
45+
connection.call(do: :memory_dump, path: path)
46+
47+
expect(File.size(path)).to be > 0
48+
ensure
49+
client_task&.stop
50+
end
51+
end
3352
end

0 commit comments

Comments
 (0)