This repository has been archived by the owner on Oct 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
tsung_offtherails.xml
155 lines (137 loc) · 8.59 KB
/
tsung_offtherails.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<?xml version="1.0"?>
<!DOCTYPE tsung SYSTEM "/opt/homebrew/Cellar/tsung/1.7.0/share/tsung/tsung-1.0.dtd">
<tsung loglevel="notice">
<clients>
<client host="localhost" maxusers="32768" use_controller_vm="true" />
</clients>
<servers>
<!--TODO: replace cs291.com with eb url-->
<server host="henry3.eba-pqkhfm2c.us-west-2.elasticbeanstalk.com" port="80" type="tcp"></server>
</servers>
<load>
<arrivalphase phase="1" duration="1" unit="minute">
<users arrivalrate="1" unit="second"></users>
</arrivalphase>
<arrivalphase phase="2" duration="1" unit="minute">
<users arrivalrate="2" unit="second"></users>
</arrivalphase>
<arrivalphase phase="3" duration="1" unit="minute">
<users arrivalrate="4" unit="second"></users>
</arrivalphase>
<arrivalphase phase="4" duration="1" unit="minute">
<users arrivalrate="8" unit="second"></users>
</arrivalphase>
<arrivalphase phase="5" duration="1" unit="minute">
<users arrivalrate="16" unit="second"></users>
</arrivalphase>
<arrivalphase phase="6" duration="1" unit="minute">
<users arrivalrate="32" unit="second"></users>
</arrivalphase>
<arrivalphase phase="7" duration="1" unit="minute">
<users arrivalrate="64" unit="second"></users>
</arrivalphase>
<!-- <arrivalphase phase="8" duration="1" unit="second">
<users arrivalrate="128" unit="second"></users>
</arrivalphase> -->
</load>
<options>
<!-- Set connection timeout to 2 seconds -->
<option name="global_ack_timeout" value="2000"></option>
</options>
<sessions>
<!--This session simulates a logged-in user browsing through the items on the homepage.-->
<session name="scenario_1" type="ts_http" weight="1">
<setdynvars sourcetype="random_number" start="1" end="100">
<var name="rand_n" />
</setdynvars>
<request subst="true"><http method="POST" url="/login/" content_type="application/json" contents="{"first_name":"","last_name":"","email":"e%%_rand_n%%@mail.com","password":"pw","password_confirmation":""}"></http></request>
<request><http method="GET" url="/items/"></http></request>
<thinktime value="3" random="true"></thinktime>
<request><http method="POST" url="/logout/"></http></request>
</session>
<!--This session simulates a non-logged in user browsing through items on the homepage.-->
<session name="scenario_2" type="ts_http" weight="1">
<setdynvars sourcetype="random_number" start="1" end="100">
<var name="rand_n1" />
</setdynvars>
<setdynvars sourcetype="random_number" start="1" end="100">
<var name="rand_n2" />
</setdynvars>
<request><http method="GET" url="/items/"></http></request>
<thinktime value="3" random="true"></thinktime>
<request subst="true"><http method="GET" url="/items/%%_rand_n1%%/"></http></request>
<thinktime value="3" random="true"></thinktime>
<request><http method="GET" url="/items/"></http></request>
<thinktime value="3" random="true"></thinktime>
<request subst="true"><http method="GET" url="/items/%%_rand_n2%%/"></http></request>
</session>
<!--This session simulates an authenticated user viewing and purchasing one item, then looking at their purchase history.-->
<session name="scenario_3" type="ts_http" weight="1">
<setdynvars sourcetype="random_number" start="1" end="100">
<var name="rand_n1" />
</setdynvars>
<setdynvars sourcetype="random_number" start="1" end="100">
<var name="rand_n2" />
</setdynvars>
<setdynvars sourcetype="random_number" start="1" end="10">
<var name="rand_order_id" />
</setdynvars>
<request subst="true"><http method="POST" url="/login/" content_type="application/json" contents="{"first_name":"","last_name":"","email":"e%%_rand_n1%%@mail.com","password":"pw","password_confirmation":""}"></http></request>
<request><http method="GET" url="/items/"></http></request>
<thinktime value="3" random="true"></thinktime>
<request subst="true">
<http method="GET" url="/items/%%_rand_n2%%/"></http>
</request>
<request subst="true">
<http method="GET" content_type="application/json" url="/current_order?user_id=%%_rand_n1%%"></http>
</request>
<!--Fetch the item!-->
<request subst="true"><http method="POST" content_type="application/json" url="/order_items/" contents="{"order_item":{"quantity":1,"order_id":%%_rand_order_id%%,"item_id":"%%_rand_n2%%"}}"></http></request>
<request subst="true"><http method="PATCH" content_type="application/json" url="/orders/%%_rand_order_id%%/" contents="{"user_id":%%_rand_n1%%,"purchased":true}"></http></request>
<thinktime value="3" random="true"></thinktime>
<!--View purchase history-->
<request subst="true"><http method="GET" url="/order_history/%%_rand_order_id%%/"></http></request>
<!--Logout-->
<thinktime value="3" random="true"></thinktime>
<request><http method="POST" url="/logout/"></http></request>
</session>
<!-- This session simulates an authenticated user creating, updating, and deleting a new item listing.-->
<session name="scenario_4" type="ts_http" weight="1">
<setdynvars sourcetype="random_number" start="1" end="100">
<var name="rand_n1" />
</setdynvars>
<setdynvars sourcetype="random_number" start="1" end="1010">
<var name="rand_item_id" />
</setdynvars>
<request subst="true"><http method="POST" url="/login/" content_type="application/json" contents="{"first_name":"","last_name":"","email":"e%%_rand_n1%%@mail.com","password":"pw","password_confirmation":""}"></http></request>
<request><http method="GET" url="/items/"></http></request>
<request subst="true">
<http method="POST" url="/items/" content_type="application/json" contents="{"name":"a","price":"1","quantity":"1","show":true,"image_link":"hello","seller_id":%%_rand_n1%%}"></http>
</request>
<thinktime value="3" random="true"></thinktime>
<request subst="true"><http method="PATCH" content_type="application/json" url="/items/%%_rand_item_id%%/" contents="{"name":"b","price":"1","quantity":"1","show":true,"image_link":"hello","seller_id":%%_rand_n1%%}"></http></request>
<request><http method="POST" url="/logout/"></http></request>
</session>
<!--This session simulates an authenticated user leaving a review, editing their review, then deleting it.-->
<session name="scenario_5" type="ts_http" weight="1">
<setdynvars sourcetype="random_number" start="1" end="100">
<var name="rand_n1" />
</setdynvars>
<setdynvars sourcetype="random_number" start="1" end="100">
<var name="rand_n2" />
</setdynvars>
<setdynvars sourcetype="random_number" start="1" end="100">
<var name="my_review_id" />
</setdynvars>
<request subst="true"><http method="POST" url="/login/" content_type="application/json" contents="{"first_name":"","last_name":"","email":"e%%_rand_n1%%@mail.com","password":"pw","password_confirmation":""}"></http></request>
<request><http method="GET" url="/items/"></http></request>
<request subst="true"><http method="GET" url="/items/%%_rand_n2%%/"></http></request>
<request subst="true">
<http method="POST" url="/ratings/" content_type="application/json" contents="{"comment":"", "score":"5", "item_id":"%%_rand_n2%%", "user_id":"%%_rand_n1%%"}"></http>
</request>
<thinktime value="3" random="true"></thinktime>
<request subst="true"><http method="PATCH" url="/ratings/%%_my_review_id%%/" contents="{"comment":"", "score":"3", "item_id":"%%_rand_n2%%", "user_id":"%%_rand_n1%%"}"></http></request>
<request><http method="POST" url="/logout/"></http></request>
</session>
</sessions>
</tsung>