github.com/yandex/pandora@v0.5.32/tests/grpc_scenario/testdata/grpc_payload.hcl (about)

     1  variable_source "users" "file/csv" {
     2    file              = "testdata/users.csv"
     3    fields            = ["user_id", "login", "pass"]
     4    ignore_first_line = true
     5    delimiter         = ","
     6  }
     7  variable_source "filter_src" "file/json" {
     8    file = "testdata/filter.json"
     9  }
    10  variable_source "global" "variables" {
    11    variables = {
    12      tmpInt = "randInt(0, 30)"
    13      tmpString = "randString(10, asdf)"
    14    }
    15  }
    16  
    17  call "auth_req" {
    18    call     = "target.TargetService.Auth"
    19    tag      = "auth"
    20    metadata = {
    21      "metadata" = "server.proto"
    22    }
    23    preprocessor "prepare" {
    24      mapping = {
    25        user = "source.users[next]"
    26        uuid = "uuid()"
    27      }
    28    }
    29    payload = <<EOF
    30  {"login": "{{.request.auth_req.preprocessor.user.login}}", "pass": "{{.request.auth_req.preprocessor.user.pass}}"}
    31  EOF
    32    postprocessor "assert/response" {
    33      payload     = ["token"]
    34      status_code = 200
    35    }
    36  }
    37  
    38  call "list_req" {
    39    call     = "target.TargetService.List"
    40    tag      = "list"
    41    metadata = {
    42      "metadata" = "server.proto"
    43    }
    44    payload = <<EOF
    45  {"user_id": {{.request.auth_req.postprocessor.userId}}, "token": "{{.request.auth_req.postprocessor.token}}"}
    46  EOF
    47  }
    48  
    49  call "order_req" {
    50    call     = "target.TargetService.Order"
    51    tag      = "order"
    52    metadata = {
    53      "metadata" = "server.proto"
    54    }
    55    payload = <<EOF
    56  {"user_id": {{.request.auth_req.postprocessor.userId}}, "item_id": {{.request.order_req.preprocessor.item_id}}, "token": "{{.request.auth_req.postprocessor.token}}"}
    57  EOF
    58    preprocessor "prepare" {
    59      mapping = {
    60        item_id = "request.list_req.postprocessor.result[rand].itemId"
    61      }
    62    }
    63  }
    64  
    65  scenario "scenario1" {
    66    weight           = 1
    67    min_waiting_time = 1000
    68    requests         = [
    69      "auth_req(1)",
    70      "list_req(1)",
    71      "order_req(3)"
    72    ]
    73  }