forked from Comcast/plax
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathelapsed.yaml
43 lines (39 loc) · 1.17 KB
/
elapsed.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
doc: |
Check out how fast your machine (and Plax) is.
Publish and receive some messages. Then emit the elapsed time.
Example:
(for I in {1..10}; do
plax -test demos/example-elapsed.yaml -json 2> /dev/null;
done) |
jq -r --slurp 'map(.[1].State.elapsed) | add/length'
labels:
- selftest
spec:
phases:
phase1:
steps:
- '$include<include/mock.yaml>'
- run: |
// Remember the current time(stamp).
test.State.then = now();
- pub:
payload: '{"want":"queso"}'
- recv:
pattern: '{"want":"?*x"}'
- pub:
payload: '{"want":"chips"}'
- recv:
pattern: '{"want":"?*x"}'
- pub:
payload: '{"want":"tacos"}'
- recv:
pattern: '{"want":"?*x"}'
- pub:
payload: '{"want":"guacamole"}'
- recv:
pattern: '{"want":"?*x"}'
- run: |
// Compute the elapsed time in milliseconds.
var elapsed = tsMs(now()) - tsMs(test.State.then);
// test.State will be printed when using the -json CLI flag.
test.State["elapsed"] = elapsed;