github.com/yandex/pandora@v0.5.32/tests/http_scenario/testdata/http_payload.hcl (about) 1 2 variable_source "users" "file/csv" { 3 file = "testdata/users.csv" 4 fields = ["user_id", "name", "pass"] 5 ignore_first_line = true 6 delimiter = "," 7 } 8 variable_source "filter_src" "file/json" { 9 file = "testdata/filter.json" 10 } 11 variable_source "global" "variables" { 12 variables = { 13 id = "randInt(10,20)" 14 } 15 } 16 request "auth_req" { 17 method = "POST" 18 uri = "/auth" 19 headers = { 20 Content-Type = "application/json" 21 Useragent = "Yandex" 22 Global-Id = "{{ .source.global.id }}" 23 } 24 tag = "auth" 25 body = <<EOF 26 {"user_id": {{.request.auth_req.preprocessor.user_id}}, "name":"{{.request.auth_req.preprocessor.rand_name}}", "uuid":"{{uuid}}"} 27 EOF 28 templater { 29 type = "html" 30 } 31 32 preprocessor { 33 mapping = { 34 user_id = "source.users[next].user_id" 35 rand_name = "randString(5, abc)" 36 } 37 } 38 postprocessor "var/header" { 39 mapping = { 40 Content-Type = "Content-Type|upper" 41 auth = "Authorization|substr(7)" 42 } 43 } 44 postprocessor "var/jsonpath" { 45 mapping = { 46 result = "$.result" 47 } 48 } 49 postprocessor "assert/response" { 50 headers = { 51 Content-Type = "json" 52 } 53 body = ["{\"result\":\"ok\"}"] 54 size { 55 op = ">" 56 val = 10 57 } 58 } 59 postprocessor "assert/response" { 60 body = ["result"] 61 } 62 } 63 request "list_req" { 64 method = "GET" 65 headers = { 66 Authorization = "Bearer {{.request.auth_req.postprocessor.auth}}" 67 Content-Type = "application/json" 68 Useragent = "Yandex" 69 } 70 tag = "list" 71 uri = "/list" 72 73 postprocessor "var/jsonpath" { 74 mapping = { 75 item_id = "$.items[0]" 76 items = "$.items" 77 } 78 } 79 } 80 request "order_req" { 81 method = "POST" 82 uri = "/order" 83 headers = { 84 Authorization = "Bearer {{.request.auth_req.postprocessor.auth}}" 85 Content-Type = "application/json" 86 Useragent = "Yandex" 87 } 88 tag = "order_req" 89 body = <<EOF 90 {"item_id": {{.request.order_req.preprocessor.item}}} 91 EOF 92 93 preprocessor { 94 mapping = { 95 item = "request.list_req.postprocessor.items[next]" 96 } 97 } 98 } 99 100 request "order_req2" { 101 method = "POST" 102 uri = "/order" 103 headers = { 104 Authorization = "Bearer {{.request.auth_req.postprocessor.auth}}" 105 Content-Type = "application/json" 106 Useragent = "Yandex" 107 } 108 tag = "order_req" 109 body = <<EOF 110 {"item_id": {{.request.order_req2.preprocessor.item}} } 111 EOF 112 113 preprocessor { 114 mapping = { 115 item = "request.list_req.postprocessor.items[next]" 116 } 117 } 118 } 119 120 scenario "scenario_name" { 121 weight = 50 122 min_waiting_time = 10 123 requests = [ 124 "auth_req(1)", 125 "sleep(100)", 126 "list_req(1)", 127 "sleep(100)", 128 "order_req(3)" 129 ] 130 }