[Tsung] Can I use file_server per-user with dynamically computed file name?

Nicolas Niclausse nicolas at niclux.org
Thu Oct 13 23:46:06 CEST 2011


Nicolas Niclausse ecrivait le 13/10/2011 17:02:
>

this one is ok (a bit ugly, but it works):

   <session name="http_csv" probability="100" type="ts_http">

<!--get an IP from the registry file -->
    <setdynvars sourcetype="file" fileid="registry" delimiter=";" order="iter">
         <var name="ipserver" />
    </setdynvars>

<!--start a file server for this session using the IP -->

    <setdynvars sourcetype="eval" code="fun({Pid,DynVars})->
                            {ok,Id}=ts_dynvars:lookup(tsung_userid,DynVars),
                            {ok,IP}=ts_dynvars:lookup(ipserver,DynVars),
                            ts_file_server:read([{Id, IP ++ 
&quot;.txt&quot; }],10000)
                          end.">
         <var name="useless" />
    </setdynvars>

  <repeat name="myloop" >

<!-- get the next line from our csv -->

    <setdynvars sourcetype="eval"
                   code="fun({Pid,DynVars})->
                            {ok,Id}=ts_dynvars:lookup(tsung_userid,DynVars),
                            {ok, Val} = ts_file_server:get_next_line(Id),
                            Val
                          end.">
         <var name="myurl" />
    </setdynvars>
   <if var="myurl" neq="endmark">
    <request subst="true">
           <http url="%%_myurl%%" version='1.1' method='GET' />
     </request>
   </if>
  <!--  the last line of the file should be "endmark"-->
  <until var="myurl" eq="endmark"/> </repeat>

-- 
Nicolas


More information about the Tsung-users mailing list