@@ -76,10 +76,8 @@ def reader_target.dispatch(call)
7676 )
7777
7878 # Verify we got the forwarded response
79- expect ( result ) . to have_keys ( :data )
80- require "json"
81- report = JSON . parse ( result [ :data ] )
82- expect ( report ) . to have_keys ( "total_allocated" , "total_retained" )
79+ expect ( result ) . to have_keys ( :report )
80+ expect ( result [ :report ] ) . to have_keys ( :total_allocated , :total_retained )
8381 ensure
8482 client_conn &.close
8583 worker_task &.stop
@@ -119,39 +117,12 @@ def reader_target.dispatch(call); end
119117 # Sample for a short duration (1 second for test speed)
120118 result = connection . call ( do : :memory_sample , duration : 1 )
121119
122- # The result should contain a JSON report
123- expect ( result ) . to have_keys ( :data )
124- expect ( result [ :data ] ) . to be_a ( String )
125- expect ( result [ :data ] ) . not . to be ( :empty? )
126-
127- # Parse the JSON to verify it's valid
128- require "json"
129- report_data = JSON . parse ( result [ :data ] )
130- expect ( report_data ) . to have_keys ( "total_allocated" , "total_retained" )
120+ # The result should contain a report
121+ expect ( result ) . to have_keys ( :report )
122+ expect ( result [ :report ] ) . to have_keys ( :total_allocated , :total_retained )
131123 ensure
132124 worker_task &.stop
133125 end
134126
135- it "can save memory sample report to file" do
136- worker = Async ::Container ::Supervisor ::Worker . new ( state , endpoint : endpoint )
137- worker_task = worker . run
138-
139- sleep ( 0.001 ) until registration_monitor . registrations . any?
140-
141- path = File . join ( @root , "memory_report.json" )
142- connection = registration_monitor . registrations . first
143- connection . call ( do : :memory_sample , duration : 1 , path : path )
144-
145- expect ( File . exist? ( path ) ) . to be == true
146- expect ( File . size ( path ) ) . to be > 0
147-
148- # Verify it's valid JSON
149- require "json"
150- content = File . read ( path )
151- report_data = JSON . parse ( content )
152- expect ( report_data ) . to have_keys ( "total_allocated" , "total_retained" )
153- ensure
154- worker_task &.stop
155- end
156127 end
157128end
0 commit comments