|
| 1 | +states: |
| 2 | + - name: degraded |
| 3 | + priority: 1 |
| 4 | + |
| 5 | +ui: |
| 6 | + state-colors: |
| 7 | + degraded: "#FFA500" # Orange color for degraded state |
| 8 | + |
1 | 9 | endpoints: |
2 | | - - name: front-end |
| 10 | + - name: healthy-test |
3 | 11 | group: core |
4 | | - url: "https://twin.sh/health" |
5 | | - interval: 5m |
| 12 | + url: "icmp://9.9.9.9" |
| 13 | + interval: 10s |
6 | 14 | conditions: |
7 | | - - "[STATUS] == 200" |
8 | | - - "[BODY].status == UP" |
9 | | - - "[RESPONSE_TIME] < 150" |
| 15 | + - "[CONNECTED] == true" |
10 | 16 |
|
11 | | - - name: back-end |
| 17 | + - name: maintenance-test |
12 | 18 | group: core |
13 | | - url: "https://example.org/" |
14 | | - interval: 5m |
| 19 | + url: "http://localhost:8088/" |
| 20 | + interval: 10s |
15 | 21 | conditions: |
16 | 22 | - "[STATUS] == 200" |
17 | | - - "[CERTIFICATE_EXPIRATION] > 48h" |
| 23 | + - "[RESPONSE_TIME] < 150" |
| 24 | + maintenance-windows: |
| 25 | + - start: "12:00" |
| 26 | + duration: "23h59m" |
18 | 27 |
|
19 | | - - name: monitoring |
20 | | - group: internal |
21 | | - url: "https://example.org/" |
22 | | - interval: 5m |
| 28 | + - name: degraded-test |
| 29 | + group: core |
| 30 | + url: "icmp://9.9.9.9" |
| 31 | + interval: 10s |
23 | 32 | conditions: |
24 | | - - "[STATUS] == 200" |
| 33 | + - "[CONNECTED] == true" |
| 34 | + - "degraded::[RESPONSE_TIME] < 22" |
25 | 35 |
|
26 | | - - name: nas |
27 | | - group: internal |
28 | | - url: "https://example.org/" |
29 | | - interval: 5m |
| 36 | + - name: unhealthy-test |
| 37 | + group: core |
| 38 | + url: "http://doesnotexist.local/" |
| 39 | + interval: 10s |
30 | 40 | conditions: |
31 | 41 | - "[STATUS] == 200" |
32 | 42 |
|
33 | | - - name: example-dns-query |
34 | | - url: "8.8.8.8" # Address of the DNS server to use |
35 | | - interval: 5m |
36 | | - dns: |
37 | | - query-name: "example.com" |
38 | | - query-type: "A" |
39 | | - conditions: |
40 | | - - "[BODY] == pat(*.*.*.*)" # Matches any IPv4 address |
41 | | - - "[DNS_RCODE] == NOERROR" |
| 43 | +suites: |
| 44 | + - name: item-crud-workflow |
| 45 | + group: api-tests |
| 46 | + interval: 10s |
| 47 | + context: |
| 48 | + price: "19.99" # Initial static value in context |
| 49 | + endpoints: |
| 50 | + # Step 1: Create an item and store the item ID |
| 51 | + - name: create-item |
| 52 | + url: https://api.example.com/items |
| 53 | + method: POST |
| 54 | + body: '{"name": "Test Item", "price": "[CONTEXT].price"}' |
| 55 | + conditions: |
| 56 | + - "[STATUS] == 201" |
| 57 | + - "len([BODY].id) > 0" |
| 58 | + - "[BODY].price == [CONTEXT].price" |
| 59 | + store: |
| 60 | + itemId: "[BODY].id" |
| 61 | + alerts: |
| 62 | + - type: slack |
| 63 | + description: "Failed to create item" |
42 | 64 |
|
43 | | - - name: icmp-ping |
44 | | - url: "icmp://example.org" |
45 | | - interval: 1m |
46 | | - conditions: |
47 | | - - "[CONNECTED] == true" |
| 65 | + # Step 2: Update the item using the stored item ID |
| 66 | + - name: update-item |
| 67 | + url: https://api.example.com/items/[CONTEXT].itemId |
| 68 | + method: PUT |
| 69 | + body: '{"price": "24.99"}' |
| 70 | + conditions: |
| 71 | + - "[STATUS] == 200" |
| 72 | + alerts: |
| 73 | + - type: slack |
| 74 | + description: "Failed to update item" |
48 | 75 |
|
49 | | - - name: check-domain-expiration |
50 | | - url: "https://example.org/" |
51 | | - interval: 1h |
52 | | - conditions: |
53 | | - - "[DOMAIN_EXPIRATION] > 720h" |
| 76 | + # Step 3: Fetch the item and validate the price |
| 77 | + - name: get-item |
| 78 | + url: https://api.example.com/items/[CONTEXT].itemId |
| 79 | + method: GET |
| 80 | + conditions: |
| 81 | + - "[STATUS] == 200" |
| 82 | + - "[BODY].price == 24.99" |
| 83 | + alerts: |
| 84 | + - type: slack |
| 85 | + description: "Item price did not update correctly" |
| 86 | + |
| 87 | + # Step 4: Delete the item (always-run: true to ensure cleanup even if step 2 or 3 fails) |
| 88 | + - name: delete-item |
| 89 | + url: https://api.example.com/items/[CONTEXT].itemId |
| 90 | + method: DELETE |
| 91 | + always-run: true |
| 92 | + conditions: |
| 93 | + - "[STATUS] == 204" |
| 94 | + alerts: |
| 95 | + - type: slack |
| 96 | + description: "Failed to delete item" |
0 commit comments