github.com/yandex/pandora@v0.5.32/components/providers/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 "variables" "variables" {
    11    variables = {
    12      header = "yandex"
    13      b      = "s"
    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      }
    27    }
    28    payload = <<EOF
    29  {"login": "{{.request.auth_req.preprocessor.user.login}}", "pass": "{{.request.auth_req.preprocessor.user.pass}}"}
    30  EOF
    31    postprocessor "assert/response" {
    32      payload     = ["token"]
    33      status_code = 200
    34    }
    35  }
    36  
    37  call "list_req" {
    38    call     = "target.TargetService.List"
    39    tag      = "list"
    40    metadata = {
    41      "metadata" = "server.proto"
    42    }
    43    payload = <<EOF
    44  {"user_id": {{.request.auth_req.postprocessor.userId}}, "token": "{{.request.auth_req.postprocessor.token}}"}
    45  EOF
    46  }
    47  
    48  call "order_req" {
    49    call     = "target.TargetService.Order"
    50    tag      = "order"
    51    metadata = {
    52      "metadata" = "server.proto"
    53    }
    54    payload = <<EOF
    55  {"user_id": {{.request.auth_req.postprocessor.userId}}, "item_id": {{.request.order_req.preprocessor.item_id}}, "token": "{{.request.auth_req.postprocessor.token}}"}
    56  EOF
    57    preprocessor "prepare" {
    58      mapping = {
    59        item_id = "request.list_req.postprocessor.result[rand].itemId"
    60      }
    61    }
    62  }
    63  
    64  scenario "scenario_name" {
    65    weight           = 50
    66    min_waiting_time = 10
    67    requests         = [
    68      "auth_req(1)",
    69      "sleep(100)",
    70      "list_req(1)",
    71      "sleep(100)",
    72      "order_req(3)"
    73    ]
    74  }
    75  
    76  scenario "scenario_2" {
    77    requests         = [
    78      "auth_req(1)",
    79      "sleep(100)",
    80      "list_req(1)",
    81      "sleep(100)",
    82      "order_req(2)"
    83    ]
    84  }