feat(loadtest): IFT Tsung smoke/mix + verification_token на стендах. Refs EventHub/EventHubBack#30
This commit is contained in:
@@ -0,0 +1,173 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE tsung SYSTEM "/usr/share/tsung/tsung-1.0.dtd">
|
||||
<!--
|
||||
IFT load mix: auth_browse 60% + create_flow 40%.
|
||||
Auth: register → verify (verification_token на стендах) → login.
|
||||
Перед прогоном: EVENTHUB_REPLICAS=1 bash …/ift-loadtest-prepare.sh
|
||||
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"/>
|
||||
</options>
|
||||
|
||||
<sessions>
|
||||
<session name="auth_browse" probability="60" type="ts_http">
|
||||
<setdynvars sourcetype="random_number" start="100000" end="9999999">
|
||||
<var name="rand_id"/>
|
||||
</setdynvars>
|
||||
|
||||
<request subst="true">
|
||||
<dyn_variable name="vtoken" re=""verification_token"\s*:\s*"([^"]+)"/>
|
||||
<match do="abort" when="nomatch">HTTP/1.[0-1] 20</match>
|
||||
<http url="/v1/register" 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/1.[0-1] 20</match>
|
||||
<http url="/v1/verify" method="POST" content_type="application/json"
|
||||
contents='{"token":"%%_vtoken%%"}'/>
|
||||
</request>
|
||||
<thinktime value="1"/>
|
||||
|
||||
<request subst="true">
|
||||
<dyn_variable name="token" re=""token"\s*:\s*"([^"]+)"/>
|
||||
<match do="abort" when="nomatch">HTTP/1.[0-1] 20</match>
|
||||
<http url="/v1/login" 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/1.[0-1] 20</match>
|
||||
<http url="/v1/user/me" 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/1.[0-1] 20</match>
|
||||
<http url="/v1/calendars" 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/1.[0-1] 20</match>
|
||||
<http url="/v1/search?q=lt" 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/1.[0-1] 20</match>
|
||||
<http url="/v1/user/bookings" method="GET">
|
||||
<http_header name="Authorization" value="Bearer %%_token%%"/>
|
||||
</http>
|
||||
</request>
|
||||
</session>
|
||||
|
||||
<session name="create_flow" probability="40" type="ts_http">
|
||||
<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">
|
||||
<dyn_variable name="vtoken" re=""verification_token"\s*:\s*"([^"]+)"/>
|
||||
<match do="abort" when="nomatch">HTTP/1.[0-1] 20</match>
|
||||
<http url="/v1/register" 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/1.[0-1] 20</match>
|
||||
<http url="/v1/verify" method="POST" content_type="application/json"
|
||||
contents='{"token":"%%_vtoken%%"}'/>
|
||||
</request>
|
||||
<thinktime value="1"/>
|
||||
|
||||
<request subst="true">
|
||||
<dyn_variable name="token" re=""token"\s*:\s*"([^"]+)"/>
|
||||
<match do="abort" when="nomatch">HTTP/1.[0-1] 20</match>
|
||||
<http url="/v1/login" 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">
|
||||
<dyn_variable name="calendar_id" re=""id"\s*:\s*"([^"]+)"/>
|
||||
<match do="abort" when="nomatch">HTTP/1.[0-1] 20</match>
|
||||
<http url="/v1/calendars" 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/1.[0-1] 20</match>
|
||||
<http url="/v1/calendars/%%_calendar_id%%" method="GET">
|
||||
<http_header name="Authorization" value="Bearer %%_token%%"/>
|
||||
</http>
|
||||
</request>
|
||||
<thinktime value="1"/>
|
||||
|
||||
<request subst="true">
|
||||
<dyn_variable name="event_id" re=""id"\s*:\s*"([^"]+)"/>
|
||||
<match do="abort" when="nomatch">HTTP/1.[0-1] 20</match>
|
||||
<http url="/v1/calendars/%%_calendar_id%%/events" 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/1.[0-1] 20</match>
|
||||
<http url="/v1/events/%%_event_id%%" method="GET">
|
||||
<http_header name="Authorization" value="Bearer %%_token%%"/>
|
||||
</http>
|
||||
</request>
|
||||
<thinktime value="1"/>
|
||||
|
||||
<request subst="true">
|
||||
<match do="log" when="nomatch">HTTP/1.[0-1] 20</match>
|
||||
<http url="/v1/calendars" method="GET">
|
||||
<http_header name="Authorization" value="Bearer %%_token%%"/>
|
||||
</http>
|
||||
</request>
|
||||
</session>
|
||||
</sessions>
|
||||
</tsung>
|
||||
Reference in New Issue
Block a user