add a simple shell script to test websocket proxy
This commit is contained in:
parent
5423a31d5a
commit
a8284e64e3
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"remote_urls": {
|
"remote_urls": {
|
||||||
"echo.localhost:8008": "ws://localhost:9009",
|
"echo.localhost:8008": "ws://localhost:8009",
|
||||||
"cobra.localhost:8008": "ws://localhost:8765"
|
"cobra.localhost:8008": "ws://localhost:5678"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
39
ws/test_ws_proxy.sh
Normal file
39
ws/test_ws_proxy.sh
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# This test requires cobra to be available
|
||||||
|
which cobra > /dev/null || {
|
||||||
|
echo cobra is not installed on this machine.
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Handle Ctrl-C by killing all sub-processing AND exiting
|
||||||
|
trap cleanup INT
|
||||||
|
|
||||||
|
function cleanup {
|
||||||
|
exit_code=${1:-1}
|
||||||
|
echo "Killing all servers (ws and cobra)"
|
||||||
|
echo
|
||||||
|
kill `cat /tmp/pidfile.proxy` &>/dev/null
|
||||||
|
kill `cat /tmp/pidfile.echo_server` &>/dev/null
|
||||||
|
kill `cat /tmp/pidfile.cobra` &>/dev/null
|
||||||
|
kill `cat /tmp/pidfile.connect.echo` &>/dev/null
|
||||||
|
kill `cat /tmp/pidfile.connect.cobra` &>/dev/null
|
||||||
|
exit ${exit_code}
|
||||||
|
}
|
||||||
|
|
||||||
|
ws proxy_server --pidfile /tmp/pidfile.proxy --config_path proxyConfig.json &
|
||||||
|
ws echo_server --pidfile /tmp/pidfile.echo_server --port 8009 &
|
||||||
|
cobra -v run --pidfile /tmp/pidfile.cobra --port 5678 &
|
||||||
|
|
||||||
|
# Wait for the servers to be up
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
# unbuffer comes with expect (written in tcl)
|
||||||
|
echo 'hello' | unbuffer ws connect --pidfile /tmp/pidfile.connect.echo ws://echo.localhost:8008 &
|
||||||
|
|
||||||
|
echo 'hello' | unbuffer ws connect --pidfile /tmp/pidfile.connect.cobra ws://cobra.localhost:8008 &
|
||||||
|
|
||||||
|
# Wait
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
cleanup
|
Loading…
Reference in New Issue
Block a user