-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathrandom_search.yaml
197 lines (189 loc) · 5.11 KB
/
random_search.yaml
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# Run this file with the test-server, then specify the PORT as a parameter to this try or run script.
vars:
port: "${PORT}"
peakLoadSearch: 400
### Percentages of search type ####
percentageName: 8
percentageCountry: 52
percentageState: 6
percentageFromDate: 22
percentageGender: 15
percentageIncludeProperties: 50
load_pattern:
- linear:
from: 100%
to: 100%
over: 15s
config:
client:
headers:
TestTime: '${epoch("ms")}'
Accept: application/json
providers:
date_range:
range:
start: 1000
end: 2000
step: 10
repeat: true
country:
list:
repeat: true
random: true
values:
- Canada
- Brazil
- Germany
- Australia
- Japan
- France
- Mexico
- Italy
- South Africa
- Sweden
- India
- Russia
- United Kingdom
- Argentina
- China
- Spain
- Egypt
- Greece
- Netherlands
- New Zealand
- Thailand
- Turkey
- United States
- Kenya
- Peru
- Colombia
- Saudi Arabia
us_state:
list:
repeat: true
random: true
values:
- California
- Texas
- New York
- Florida
- Illinois
- Pennsylvania
- Ohio
- Georgia
- North Carolina
- Michigan
- New Jersey
- Virginia
- Washington
- Arizona
- Massachusetts
- Tennessee
- Indiana
- Missouri
- Maryland
- Wisconsin
- Colorado
- Minnesota
- South Carolina
- Alabama
- Louisiana
person:
file:
path: random_search.csv
repeat: true
format: csv
csv:
headers: first_name,last_name,birth_date,gender
random: true
loggers:
test:
to: stdout
http_errors:
select:
timestamp: epoch("ms")
request: request["start-line"]
method: request.method
url: request.url
requestHeaders: request.headers
requestBody: request.body
response: response["start-line"]
status: response.status
responseHeaders: response.headers
responseBody: response.body
where: response.status >= 400
limit: 1000
to: stdout
pretty: false
search_logger:
to: 'search-results-${epoch("ms")}.json' # log to a file with a timestamp. timestamp set at test start
pretty: false
endpoints:
- method: PUT
url: http://localhost:${port}
tags:
# Results will be bucketed based on these tags. All hasName: true will be grouped together
type: random search
hasCountry: ${hasCountry}
hasState: ${hasState}
hasFromDate: ${hasFromDate}
hasName: ${hasName}
hasGender: ${hasGender}
includeProperties: ${includeProperties}
status: ${response.status} # Tag the result based on the response status
declare:
whenFacetArray: collect(date_range, 2) # Get two dates in case we need them for hasFromDate
# Based on the random percentages, decide whether to includes these in the search
hasCountry: random(0,100) < percentageCountry
hasState: random(0,100) < percentageState
hasFromDate: random(0,100) < percentageFromDate
hasName: random(0,100) < percentageName
hasGender: random(0,100) < percentageGender
includeProperties: random(0,100) < percentageIncludeProperties
goPage2: random(0,100) < 7
headers:
Content-Type: application/json
body: >-
{
"hasCountry": ${hasCountry},
${if(hasCountry, '"country": ["${country}"],', "")}
${if((hasCountry == false || country == "United States") && hasState, '"state": ["${us_state}"],', "")}
"fromDate": ${if(hasFromDate, '"${whenFacetArray[0]}"', null)},
"toDate": ${if(hasFromDate, '"${whenFacetArray[1]}"', null)}
"name": ${if(hasName, '"${person.last_name}"', null)},
"gender": ${if(hasGender, '"${person.gender}"', null)},
"includeProperties": ${includeProperties},
"pageNumber": ${if(goPage2, 2, 1)},
"results": 50,
"totalCount": ${random(0,1000)}
}
peak_load: ${peakLoadSearch}hpm
load_pattern: # Override the default load pattern for this endpoint
- linear:
from: 10%
to: 100%
over: 5s
- linear:
from: 100%
to: 100%
over: 10s
logs:
search_logger:
select:
timestamp: epoch("ms")
type: '`random search`'
method: request.method
pathname: request.url.pathname
response: response["start-line"]
status: response.status
totalCount: response.body.totalCount
hasCountry: hasCountry
hasState: hasState
hasFromDate: hasFromDate
hasName: hasName
hasGender: hasGender
includeProperties: includeProperties
where: response.status < 300 && response.body != null
test:
select: response.body.totalCount
where: response.body != null && response.body.totalCount != null