github.com/anycable/anycable-go@v1.5.1/features/shutdown.testfile (about) 1 launch :rpc, "bundle exec anyt --only-rpc", env: {"ANYCABLE_DEBUG" => "1"}, capture_output: true 2 wait_tcp 50051 3 4 launch :anycable, 5 "./dist/anycable-go --disconnect_mode=always --disconnect_rate=1" 6 wait_tcp 8080 7 8 scenario = [ 9 client: { 10 multiplier: 3, 11 actions: [ 12 { 13 receive: { 14 "data>": { 15 type: "welcome" 16 } 17 } 18 }, 19 { 20 sleep: { 21 time: 4 22 } 23 } 24 ] 25 } 26 ] 27 28 TEST_COMMAND = <<~CMD 29 bundle exec wsdirector ws://localhost:8080/cable -i #{scenario.to_json} 30 CMD 31 32 launch :wsdirector, TEST_COMMAND 33 34 sleep 1 35 36 stop :anycable 37 stop :rpc 38 39 result = stdout(:rpc) 40 41 expected = 3 42 disconnect_calls = result.scan(/^RPC Disconnect/).size 43 44 if disconnect_calls != expected 45 fail "Expected to receive #{expected} Disconnect RPC calls. Got #{disconnect_calls}:\n#{result}" 46 end