Files
EventHubBack/test/tsung/eventhub_ift.xml
T

221 lines
11 KiB
XML

<?xml version="1.0"?>
<!DOCTYPE tsung SYSTEM "/usr/share/tsung/tsung-1.0.dtd">
<!--
IFT load mix: auth_browse 60% + create_flow 40%.
Verify через admin GET /v1/admin/users/:id/verification-token.
Нужен test/tsung/ift-admin.csv (см. ift-admin.csv.example).
thinktime — секунды.
-->
<tsung loglevel="notice" version="1.0">
<clients>
<client host="localhost" use_controller_vm="true" maxusers="2000"/>
</clients>
<servers>
<server host="api.ift.eventhub.local" port="443" type="ssl"/>
</servers>
<load>
<arrivalphase phase="1" duration="1" unit="minute">
<users interarrival="1.0" unit="second"/>
</arrivalphase>
<arrivalphase phase="2" duration="2" unit="minute">
<users interarrival="0.4" unit="second"/>
</arrivalphase>
<arrivalphase phase="3" duration="3" unit="minute">
<users interarrival="0.15" unit="second"/>
</arrivalphase>
</load>
<options>
<option name="ssl_reuse" value="true"/>
<option name="file_server" id="admincred" value="test/tsung/ift-admin.csv"/>
</options>
<sessions>
<session name="auth_browse" probability="60" type="ts_http">
<setdynvars sourcetype="file" fileid="admincred" delimiter=";" order="iter">
<var name="admin_email"/>
<var name="admin_password"/>
</setdynvars>
<setdynvars sourcetype="random_number" start="100000" end="9999999">
<var name="rand_id"/>
</setdynvars>
<request subst="true">
<match do="abort" when="nomatch">HTTP/[0-9.]+ 20</match>
<dyn_variable name="admin_token" re="&quot;token&quot;\s*:\s*&quot;([^&quot;]+)"/>
<http url="https://admin-api.ift.eventhub.local/v1/admin/login" version="1.1" method="POST"
content_type="application/json"
contents='{"email":"%%_admin_email%%","password":"%%_admin_password%%"}'/>
</request>
<thinktime min="1" max="2" random="true"/>
<request subst="true">
<match do="abort" when="nomatch">HTTP/[0-9.]+ 20</match>
<dyn_variable name="user_id" re="&quot;id&quot;\s*:\s*&quot;([^&quot;]+)"/>
<http url="https://api.ift.eventhub.local/v1/register" version="1.1" method="POST" content_type="application/json"
contents='{"email":"lt_b_%%_rand_id%%@loadtest.local","password":"testpassword123"}'/>
</request>
<thinktime min="1" max="2" random="true"/>
<request subst="true">
<match do="abort" when="nomatch">HTTP/[0-9.]+ 20</match>
<dyn_variable name="vtoken" re="&quot;token&quot;\s*:\s*&quot;([^&quot;]+)"/>
<http url="https://admin-api.ift.eventhub.local/v1/admin/users/%%_user_id%%/verification-token"
version="1.1" method="GET">
<http_header name="Authorization" value="Bearer %%_admin_token%%"/>
</http>
</request>
<thinktime value="1"/>
<request subst="true">
<match do="abort" when="nomatch">HTTP/[0-9.]+ 20</match>
<http url="https://api.ift.eventhub.local/v1/verify" version="1.1" method="POST" content_type="application/json"
contents='{"token":"%%_vtoken%%"}'/>
</request>
<thinktime value="1"/>
<request subst="true">
<match do="abort" when="nomatch">HTTP/[0-9.]+ 20</match>
<dyn_variable name="token" re="&quot;token&quot;\s*:\s*&quot;([^&quot;]+)"/>
<http url="https://api.ift.eventhub.local/v1/login" version="1.1" method="POST" content_type="application/json"
contents='{"email":"lt_b_%%_rand_id%%@loadtest.local","password":"testpassword123"}'/>
</request>
<thinktime min="1" max="2" random="true"/>
<request subst="true">
<match do="abort" when="nomatch">HTTP/[0-9.]+ 20</match>
<http url="https://api.ift.eventhub.local/v1/user/me" version="1.1" method="GET">
<http_header name="Authorization" value="Bearer %%_token%%"/>
</http>
</request>
<thinktime min="1" max="2" random="true"/>
<request subst="true">
<match do="abort" when="nomatch">HTTP/[0-9.]+ 20</match>
<http url="https://api.ift.eventhub.local/v1/calendars" version="1.1" method="GET">
<http_header name="Authorization" value="Bearer %%_token%%"/>
</http>
</request>
<thinktime min="1" max="2" random="true"/>
<request subst="true">
<match do="log" when="nomatch">HTTP/[0-9.]+ 20</match>
<http url="https://api.ift.eventhub.local/v1/search?q=lt" version="1.1" method="GET">
<http_header name="Authorization" value="Bearer %%_token%%"/>
</http>
</request>
<thinktime min="1" max="2" random="true"/>
<request subst="true">
<match do="log" when="nomatch">HTTP/[0-9.]+ 20</match>
<http url="https://api.ift.eventhub.local/v1/user/bookings" version="1.1" method="GET">
<http_header name="Authorization" value="Bearer %%_token%%"/>
</http>
</request>
</session>
<session name="create_flow" probability="40" type="ts_http">
<setdynvars sourcetype="file" fileid="admincred" delimiter=";" order="iter">
<var name="admin_email"/>
<var name="admin_password"/>
</setdynvars>
<setdynvars sourcetype="random_number" start="100000" end="9999999">
<var name="rand_id"/>
</setdynvars>
<setdynvars sourcetype="random_number" start="10" end="28">
<var name="day"/>
</setdynvars>
<setdynvars sourcetype="random_number" start="10" end="59">
<var name="sec"/>
</setdynvars>
<request subst="true">
<match do="abort" when="nomatch">HTTP/[0-9.]+ 20</match>
<dyn_variable name="admin_token" re="&quot;token&quot;\s*:\s*&quot;([^&quot;]+)"/>
<http url="https://admin-api.ift.eventhub.local/v1/admin/login" version="1.1" method="POST"
content_type="application/json"
contents='{"email":"%%_admin_email%%","password":"%%_admin_password%%"}'/>
</request>
<thinktime min="1" max="2" random="true"/>
<request subst="true">
<match do="abort" when="nomatch">HTTP/[0-9.]+ 20</match>
<dyn_variable name="user_id" re="&quot;id&quot;\s*:\s*&quot;([^&quot;]+)"/>
<http url="https://api.ift.eventhub.local/v1/register" version="1.1" method="POST" content_type="application/json"
contents='{"email":"lt_c_%%_rand_id%%@loadtest.local","password":"testpassword123"}'/>
</request>
<thinktime min="1" max="2" random="true"/>
<request subst="true">
<match do="abort" when="nomatch">HTTP/[0-9.]+ 20</match>
<dyn_variable name="vtoken" re="&quot;token&quot;\s*:\s*&quot;([^&quot;]+)"/>
<http url="https://admin-api.ift.eventhub.local/v1/admin/users/%%_user_id%%/verification-token"
version="1.1" method="GET">
<http_header name="Authorization" value="Bearer %%_admin_token%%"/>
</http>
</request>
<thinktime value="1"/>
<request subst="true">
<match do="abort" when="nomatch">HTTP/[0-9.]+ 20</match>
<http url="https://api.ift.eventhub.local/v1/verify" version="1.1" method="POST" content_type="application/json"
contents='{"token":"%%_vtoken%%"}'/>
</request>
<thinktime value="1"/>
<request subst="true">
<match do="abort" when="nomatch">HTTP/[0-9.]+ 20</match>
<dyn_variable name="token" re="&quot;token&quot;\s*:\s*&quot;([^&quot;]+)"/>
<http url="https://api.ift.eventhub.local/v1/login" version="1.1" method="POST" content_type="application/json"
contents='{"email":"lt_c_%%_rand_id%%@loadtest.local","password":"testpassword123"}'/>
</request>
<thinktime min="1" max="2" random="true"/>
<request subst="true">
<match do="abort" when="nomatch">HTTP/[0-9.]+ 20</match>
<dyn_variable name="calendar_id" re="&quot;id&quot;\s*:\s*&quot;([^&quot;]+)"/>
<http url="https://api.ift.eventhub.local/v1/calendars" version="1.1" method="POST" content_type="application/json"
contents='{"title":"LT Cal %%_rand_id%%","confirmation":"auto","description":"loadtest"}'>
<http_header name="Authorization" value="Bearer %%_token%%"/>
</http>
</request>
<thinktime min="1" max="2" random="true"/>
<request subst="true">
<match do="log" when="nomatch">HTTP/[0-9.]+ 20</match>
<http url="https://api.ift.eventhub.local/v1/calendars/%%_calendar_id%%" version="1.1" method="GET">
<http_header name="Authorization" value="Bearer %%_token%%"/>
</http>
</request>
<thinktime value="1"/>
<request subst="true">
<match do="abort" when="nomatch">HTTP/[0-9.]+ 20</match>
<dyn_variable name="event_id" re="&quot;id&quot;\s*:\s*&quot;([^&quot;]+)"/>
<http url="https://api.ift.eventhub.local/v1/calendars/%%_calendar_id%%/events" version="1.1" method="POST" content_type="application/json"
contents='{"title":"LT Ev %%_rand_id%%","start_time":"2031-07-%%_day%%T12:00:%%_sec%%Z","duration":45,"capacity":30}'>
<http_header name="Authorization" value="Bearer %%_token%%"/>
</http>
</request>
<thinktime min="1" max="2" random="true"/>
<request subst="true">
<match do="abort" when="nomatch">HTTP/[0-9.]+ 20</match>
<http url="https://api.ift.eventhub.local/v1/events/%%_event_id%%" version="1.1" method="GET">
<http_header name="Authorization" value="Bearer %%_token%%"/>
</http>
</request>
<thinktime value="1"/>
<request subst="true">
<match do="log" when="nomatch">HTTP/[0-9.]+ 20</match>
<http url="https://api.ift.eventhub.local/v1/calendars" version="1.1" method="GET">
<http_header name="Authorization" value="Bearer %%_token%%"/>
</http>
</request>
</session>
</sessions>
</tsung>