Class: HotCell::Fixtures::Noisy

Inherits:
Operation show all
Defined in:
lib/hot_cell/test_operations.rb

Overview

Prints far more than any sane capture, on the stream the payload names, then exits. For proving that a noisy tool costs a bounded amount of this worker's memory rather than all of it.

Constant Summary

Constants inherited from Operation

Operation::READ_BYTES

Instance Method Summary collapse

Methods inherited from Operation

abstract_operation, abstract_operation?, before_fork, before_worker_boot, inherited, limits, operation, operation_name, #run_tool, unreadable

Instance Method Details

#perform(_inputs, _outputs, stream: "out") ⇒ Object



297
298
299
300
301
302
303
# File 'lib/hot_cell/test_operations.rb', line 297

def perform(_inputs, _outputs, stream: "out")
  stream = stream == "err" ? "STDERR" : "STDOUT"
  script = "40.times { #{stream}.write('x' * 1_000_000) }"
  result = run_tool "ruby", "-e", script, capture: 1024

  { out: result.out.bytesize, err: result.err.bytesize, ok: result.ok? }
end