github.com/anycable/anycable-go@v1.5.1/features/mruby_printers.testfile (about)

     1  launch :rpc, "bundle exec anyt --only-rpc"
     2  wait_tcp 50051
     3  
     4  launch :anycable,
     5    "./dist/anycable-go --broadcast_adapter=http --metrics_log_formatter=#{File.join(__dir__, "simple_logger.rb")} --metrics_rotate_interval=1 --ping_interval=3",
     6    capture_output: true,
     7    env: {"PRINTER_NAME" => "MRUBY PRINTER"}
     8  wait_tcp 8080
     9  
    10  scenario = [
    11    client: {
    12      multiplier: 2,
    13      actions: [
    14        {
    15          receive: {
    16            "data>": {
    17              type: "welcome"
    18            }
    19          }
    20        },
    21        {
    22          receive: {
    23            "data>": {
    24              type: "ping"
    25            }
    26          }
    27        },
    28        {
    29          receive: {
    30            "data>": {
    31              type: "ping"
    32            }
    33          }
    34        }
    35      ]
    36    }
    37  ]
    38  
    39  TEST_COMMAND = <<~CMD
    40    bundle exec wsdirector ws://localhost:8080/cable -i #{scenario.to_json}
    41  CMD
    42  
    43  run :wsdirector, TEST_COMMAND
    44  
    45  result = stdout(:wsdirector)
    46  
    47  if result !~ /2 clients, 0 failures/
    48    fail "Unexpected scenario result:\n#{result}"
    49  end
    50  
    51  stop :anycable
    52  
    53  logs = stdout(:anycable)
    54  if logs !~ /\[MRUBY PRINTER\] Connections: 2/
    55    fail "Missing metrics in logs:\n#{logs}"
    56  end