github.com/yandex/pandora@v0.5.32/tests/acceptance/testdata/http_scenario/http_payload.hcl (about) 1 2 variable_source "users" "file/csv" { 3 file = "testdata/http_scenario/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/http_scenario/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 httpAuthorization = "Http-Authorization" 42 auth = "Authorization|substr(7)" 43 } 44 } 45 postprocessor "var/jsonpath" { 46 mapping = { 47 result = "$.result" 48 } 49 } 50 postprocessor "assert/response" { 51 headers = { 52 Content-Type = "json" 53 } 54 body = ["{\"result\":\"ok\"}"] 55 size { 56 op = ">" 57 val = 10 58 } 59 } 60 postprocessor "assert/response" { 61 body = ["result"] 62 } 63 } 64 request "list_req" { 65 method = "GET" 66 headers = { 67 Authorization = "Bearer {{.request.auth_req.postprocessor.auth}}" 68 Content-Type = "application/json" 69 Useragent = "Yandex" 70 } 71 tag = "list" 72 uri = "/list" 73 74 postprocessor "var/jsonpath" { 75 mapping = { 76 item_id = "$.items[0]" 77 items = "$.items" 78 } 79 } 80 } 81 request "order_req" { 82 method = "POST" 83 uri = "/order" 84 headers = { 85 Authorization = "Bearer {{.request.auth_req.postprocessor.auth}}" 86 Content-Type = "application/json" 87 Useragent = "Yandex" 88 } 89 tag = "order_req" 90 body = <<EOF 91 {"item_id": {{.request.order_req.preprocessor.item}}} 92 EOF 93 94 preprocessor { 95 mapping = { 96 item = "request.list_req.postprocessor.items[next]" 97 } 98 } 99 } 100 101 request "order_req2" { 102 method = "POST" 103 uri = "/order" 104 headers = { 105 Authorization = "Bearer {{.request.auth_req.postprocessor.auth}}" 106 Content-Type = "application/json" 107 Useragent = "Yandex" 108 } 109 tag = "order_req" 110 body = <<EOF 111 {"item_id": {{.request.order_req2.preprocessor.item}} } 112 EOF 113 114 preprocessor { 115 mapping = { 116 item = "request.list_req.postprocessor.items[next]" 117 } 118 } 119 } 120 121 scenario "scenario_name" { 122 weight = 50 123 min_waiting_time = 10 124 requests = [ 125 "auth_req(1)", 126 "sleep(100)", 127 "list_req(1)", 128 "sleep(100)", 129 "order_req(3)" 130 ] 131 }