-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathloadgen.yml
112 lines (107 loc) · 3.17 KB
/
loadgen.yml
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
## How to use loadgen?
## $ES_ENDPOINT=https://localhost:9200 ES_USERNAME=admin ES_PASSWORD=b14612393da0d4e7a70b ./bin/loadgen -config loadgen.yml
env:
ES_USERNAME: username
ES_PASSWORD: password
ES_ENDPOINT: http://localhost:9200
runner:
# total_rounds: 1
no_warm: true
valid_status_codes_during_warmup: [ 200,201,404 ]
# Whether to log all requests
log_requests: false
# Whether to log all requests with the specified response status
log_status_codes:
- 0
- 500
assert_invalid: false
assert_error: false
# Whether to reset the context, including variables, runtime KV pairs, etc.,
# before this test run.
reset_context: false
default_endpoint: $[[env.ES_ENDPOINT]]
default_basic_auth:
username: $[[env.ES_USERNAME]]
password: $[[env.ES_PASSWORD]]
variables:
# - name: ip
# type: file
# path: dict/ip.txt
# replace: # replace special characters in the value
# '"': '\"'
# '\': '\\'
- name: id
type: sequence
- name: id64
type: sequence64
- name: uuid
type: uuid
- name: now_local
type: now_local
- name: now_utc
type: now_utc
- name: now_utc_lite
type: now_utc_lite
- name: now_unix
type: now_unix
- name: now_with_format
type: now_with_format #https://programming.guide/go/format-parse-string-time-date-example.html
format: "2006-01-02T15:04:05-0700" #2006-01-02T15:04:05
- name: suffix
type: range
from: 10
to: 1000
- name: bool
type: range
from: 0
to: 1
- name: list
type: list
data:
- "medcl"
- "abc"
- "efg"
- "xyz"
- name: id_list
type: random_array
variable_type: number # number/string
variable_key: suffix # variable key to get array items
square_bracket: false
size: 10 # how many items for array
- name: str_list
type: random_array
variable_type: string # number/string
variable_key: suffix #variable key to get array items
square_bracket: true
size: 10 # how many items for array
replace:
'"': "'" # use ' instead of " for string quotes
# use {} instead of [] as array brackets
"[": "{"
"]": "}"
requests:
- request: #prepare some docs
method: POST
runtime_variables:
batch_no: uuid
runtime_body_line_variables:
routing_no: uuid
url: /_bulk
body: |
{"index": {"_index": "medcl", "_type": "_doc", "_id": "$[[uuid]]"}}
{"id": "$[[id]]", "field1": "$[[list]]", "now_local": "$[[now_local]]", "now_unix": "$[[now_unix]]"}
{"index": {"_index": "infinilabs", "_type": "_doc", "_id": "$[[uuid]]"}}
{"id": "$[[id]]", "field1": "$[[list]]", "now_local": "$[[now_local]]", "now_unix": "$[[now_unix]]"}
- request: #search this index
method: POST
runtime_variables:
batch_no: uuid
runtime_body_line_variables:
routing_no: uuid
basic_auth: #override default auth
username: $[[env.ES_USERNAME]]
password: $[[env.ES_PASSWORD]]
url: $[[env.ES_ENDPOINT]]/medcl/_search #override with full request url
body: |
{ "track_total_hits": true, "size": 0, "query": { "terms": { "patent_id": [ $[[id_list]] ] } } }
#add more requests