Skip to content

Commit

Permalink
Added example with provider collect
Browse files Browse the repository at this point in the history
  • Loading branch information
tkmcmaster committed Nov 6, 2023
1 parent fc767b6 commit 49a3d68
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 3 deletions.
58 changes: 58 additions & 0 deletions examples/provider_collect.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Run this file with the test-server, then specify the PORT as a parameter to this try or run script.

vars:
port: "${PORT}"

load_pattern:
- linear:
from: 100%
to: 100%
over: 5s

providers:
a:
range: {}
b:
response: {}
c:
response: {}
d:
response: {}
e:
response: {}
f:
response: {}

loggers:
test:
to: stderr

endpoints:
- method: POST
url: http://localhost:${port}
body: '{"a": ${a}}'
provides:
b:
select: response.body.a
on_demand: true

- method: POST
declare:
c: collect(b, 10) # Get 10
url: http://localhost:${port}
body: '{"c": ${c}}'
provides:
d:
# select: response.body.c
select: for_each[0]
for_each:
- response.body.c
on_demand: true

- method: POST
url: http://localhost:${port}
body: '{"d": ${d}}'
peak_load: 1hps
logs:
test:
select: response.body.d
5 changes: 2 additions & 3 deletions examples/provider_loop_with_counter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ providers:
response: {}
c:
response: {}
d:
response: {}

loggers:
test:
Expand All @@ -43,8 +41,9 @@ endpoints:

- method: POST
url: http://localhost:${port}
body: '{"b": ${b.value}}'
body: '{"b": ${b.value},"counter": ${b.counter}}'
peak_load: 5hps
# on_demand: true # We can't do on_demand due to a bug where it can't figure out that we provider for ourselves
provides:
b:
select:
Expand Down

0 comments on commit 49a3d68

Please sign in to comment.