tsung icon indicating copy to clipboard operation
tsung copied to clipboard

websocket configuration conflicts

Open mdesantis opened this issue 7 years ago • 0 comments
trafficstars

I'm trying to test a websocket endpoint, but I had to disable Origin check on the websocket server because:

  • When websocket_path is set:
  <options>
    <option name="websocket_path" value="/cable"/>
  </options>

websocket origin option (<websocket type="connect" origin="http://localhost:3000"></websocket>) is ignored, making the server fail the Origin check

  • When I remove websocket_path option /chat path is set by tsung, even if I specify a different path in the request:
      <request subst="true">
        <websocket type="connect" origin="http://localhost:3000" path="/cable"></websocket>
      </request>

Details

  • tsung version: 1.7.0

  • tsung.xml:

  • 1st version (fails because of Origin check):

<?xml version="1.0"?>
<!DOCTYPE tsung SYSTEM "/usr/share/tsung/tsung-1.0.dtd" [] >
<tsung loglevel="info">
  <clients>
    <client host="localhost" use_controller_vm="true"/>
  </clients>

  <servers>
    <server host="localhost" port="3000" type="websocket"></server>
  </servers>

  <load>
    <arrivalphase phase="1" duration="100" unit="second">
      <users maxnumber="1" arrivalrate="1" unit="second" />
    </arrivalphase>
  </load>

  <options>
    <option name="websocket_path" value="/cable"/>
  </options>

  <sessions>
    <session probability="100" name="websocket-example" type="ts_websocket">
      <request subst="true">
        <websocket type="connect" origin="http://localhost:3000"></websocket>
      </request>

      <request>
        <websocket type="close"></websocket>
      </request>
    </session>
  </sessions>
</tsung>
  • 2nd version (fails because of path set to /chat):
<?xml version="1.0"?>
<!DOCTYPE tsung SYSTEM "/usr/share/tsung/tsung-1.0.dtd" [] >
<tsung loglevel="info">
  <clients>
    <client host="localhost" use_controller_vm="true"/>
  </clients>

  <servers>
    <server host="localhost" port="3000" type="websocket"></server>
  </servers>

  <load>
    <arrivalphase phase="1" duration="100" unit="second">
      <users maxnumber="1" arrivalrate="1" unit="second" />
    </arrivalphase>
  </load>

  <sessions>
    <session probability="100" name="websocket-example" type="ts_websocket">
      <request subst="true">
        <websocket type="connect" origin="http://localhost:3000" path="/cable"></websocket>
      </request>

      <request>
        <websocket type="close"></websocket>
      </request>
    </session>
  </sessions>
</tsung>

mdesantis avatar Jun 22 '18 16:06 mdesantis