Skip to content

Commit 8ff284d

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

File tree

2 files changed

+82
-38
lines changed

2 files changed

+82
-38
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 & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,97 @@
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: 1m
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: "https://twin.sh/health"
31+
interval: 1m
2332
conditions:
2433
- "[STATUS] == 200"
34+
- "[BODY].status == UP"
35+
- "[RESPONSE_TIME] < 50"
2536

26-
- name: nas
27-
group: internal
28-
url: "https://example.org/"
29-
interval: 5m
37+
- name: unhealthy-test
38+
group: core
39+
url: "http://doesnotexist.local/"
40+
interval: 1m
3041
conditions:
3142
- "[STATUS] == 200"
3243

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"
42-
43-
- name: icmp-ping
44-
url: "icmp://example.org"
44+
suites:
45+
- name: item-crud-workflow
46+
group: api-tests
4547
interval: 1m
46-
conditions:
47-
- "[CONNECTED] == true"
48+
context:
49+
price: "19.99" # Initial static value in context
50+
endpoints:
51+
# Step 1: Create an item and store the item ID
52+
- name: create-item
53+
url: https://api.example.com/items
54+
method: POST
55+
body: '{"name": "Test Item", "price": "[CONTEXT].price"}'
56+
conditions:
57+
- "[STATUS] == 201"
58+
- "len([BODY].id) > 0"
59+
- "[BODY].price == [CONTEXT].price"
60+
store:
61+
itemId: "[BODY].id"
62+
alerts:
63+
- type: slack
64+
description: "Failed to create item"
4865

49-
- name: check-domain-expiration
50-
url: "https://example.org/"
51-
interval: 1h
52-
conditions:
53-
- "[DOMAIN_EXPIRATION] > 720h"
66+
# Step 2: Update the item using the stored item ID
67+
- name: update-item
68+
url: https://api.example.com/items/[CONTEXT].itemId
69+
method: PUT
70+
body: '{"price": "24.99"}'
71+
conditions:
72+
- "[STATUS] == 200"
73+
alerts:
74+
- type: slack
75+
description: "Failed to update item"
76+
77+
# Step 3: Fetch the item and validate the price
78+
- name: get-item
79+
url: https://api.example.com/items/[CONTEXT].itemId
80+
method: GET
81+
conditions:
82+
- "[STATUS] == 200"
83+
- "[BODY].price == 24.99"
84+
alerts:
85+
- type: slack
86+
description: "Item price did not update correctly"
87+
88+
# Step 4: Delete the item (always-run: true to ensure cleanup even if step 2 or 3 fails)
89+
- name: delete-item
90+
url: https://api.example.com/items/[CONTEXT].itemId
91+
method: DELETE
92+
always-run: true
93+
conditions:
94+
- "[STATUS] == 204"
95+
alerts:
96+
- type: slack
97+
description: "Failed to delete item"

0 commit comments

Comments
 (0)