Skip to content

Commit 1bb8299

Browse files
committed
test: Update config for testing
1 parent 754d523 commit 1bb8299

File tree

2 files changed

+82
-39
lines changed

2 files changed

+82
-39
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ install:
66

77
.PHONY: run
88
run:
9-
ENVIRONMENT=dev GATUS_CONFIG_PATH=./config.yaml go run main.go
9+
ENVIRONMENT=dev GATUS_LOG_LEVEL=debug GATUS_CONFIG_PATH=./config.yaml go run main.go
1010

1111
.PHONY: run-binary
1212
run-binary:

config.yaml

Lines changed: 81 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,96 @@
1+
states:
2+
- name: degraded
3+
priority: 1
4+
5+
ui:
6+
state-colors:
7+
degraded: "#FFA500" # Orange color for degraded state
8+
19
endpoints:
2-
- name: front-end
10+
- name: healthy-test
311
group: core
4-
url: "https://twin.sh/health"
5-
interval: 5m
12+
url: "icmp://9.9.9.9"
13+
interval: 10s
614
conditions:
7-
- "[STATUS] == 200"
8-
- "[BODY].status == UP"
9-
- "[RESPONSE_TIME] < 150"
15+
- "[CONNECTED] == true"
1016

11-
- name: back-end
17+
- name: maintenance-test
1218
group: core
13-
url: "https://example.org/"
14-
interval: 5m
19+
url: "http://localhost:8088/"
20+
interval: 10s
1521
conditions:
1622
- "[STATUS] == 200"
17-
- "[CERTIFICATE_EXPIRATION] > 48h"
23+
- "[RESPONSE_TIME] < 150"
24+
maintenance-windows:
25+
- start: "12:00"
26+
duration: "23h59m"
1827

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
2332
conditions:
24-
- "[STATUS] == 200"
33+
- "[CONNECTED] == true"
34+
- "degraded::[RESPONSE_TIME] < 22"
2535

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
3040
conditions:
3141
- "[STATUS] == 200"
3242

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"
4264

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"
4875

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

Comments
 (0)