# Tagged scenarios for selective runs. Each scenario carries `tags` (a map of
# name → value); `loadr run` filters scenarios by their tag *values*.
#
#   loadr run examples/23-tags.yaml                          # all four scenarios
#   loadr run --tags smoke examples/23-tags.yaml             # only smoke scenarios
#   loadr run --tags read,write examples/23-tags.yaml        # read OR write (any-match)
#   loadr run --tags full --exclude-tags write examples/23-tags.yaml  # full, but not writes
#
# --tags keeps a scenario when it carries at least one of the listed values.
# --exclude-tags drops a scenario when it carries any of the listed values, and
# always wins over --tags.
name: tag-selection
description: smoke vs full and read vs write scenarios, selectable by tag

defaults:
  http:
    base_url: https://api.example.com

scenarios:
  # A quick read-only smoke check — `loadr run --tags smoke`.
  smoke_read:
    executor: shared-iterations
    vus: 2
    iterations: 10
    tags: { suite: smoke, kind: read }
    flow:
      - request: { name: list items, url: /api/v1/items }

  # A quick write smoke check — also picked up by `--tags smoke`.
  smoke_write:
    executor: shared-iterations
    vus: 2
    iterations: 10
    tags: { suite: smoke, kind: write }
    flow:
      - request:
          name: create item
          method: POST
          url: /api/v1/items
          body: { json: { sku: "W-1" } }
          checks: [ { type: status, equals: 201 } ]

  # The full read load — `loadr run --tags full` or `--tags read`.
  full_read:
    executor: constant-arrival-rate
    rate: 100
    duration: 5m
    pre_allocated_vus: 40
    max_vus: 120
    tags: { suite: full, kind: read }
    flow:
      - request: { name: list items, url: /api/v1/items }
      - request: { name: get item, url: /api/v1/items/1 }

  # The full write load — `loadr run --tags full`, or excluded with
  # `--exclude-tags write` for read-only soak runs.
  full_write:
    executor: ramping-vus
    start_vus: 0
    stages:
      - { duration: 1m, target: 30 }
      - { duration: 4m, target: 30 }
    tags: { suite: full, kind: write }
    flow:
      - request:
          name: create item
          method: POST
          url: /api/v1/items
          body: { json: { sku: "W-2" } }
          checks: [ { type: status, equals: 201 } ]

thresholds:
  "http_req_duration{scenario:full_read}": [ "p(95)<400" ]
