-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
67 lines (58 loc) · 2.07 KB
/
Makefile
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
.PHONY: run-server-example
run-example-server:
cargo run --package server-example
prepare-tests:
cd tests && pnpm install
run-acceptance-tests:
cd tests && pnpm run acceptance
# run acceptance tests with the example server
run-acceptance-tests-against-sample-server:
@echo "Running acceptance tests with the example server" && \
( \
echo "Starting the example server"; \
make run-example-server & \
server_pid=$$!; \
trap 'kill $$server_pid' EXIT INT TERM; \
WEBHOOK_URL=$${WEBHOOK_URL:-http://localhost:8080}; \
echo "Using WEBHOOK_URL=$$WEBHOOK_URL"; \
timeout=120; \
elapsed=0; \
while ! curl -s -o /dev/null -w "%{http_code}" $$WEBHOOK_URL/health | grep -q "200"; do \
if [ $$elapsed -ge $$timeout ]; then \
echo "Server health check timed out after $$timeout seconds"; \
kill $$server_pid; \
exit 1; \
fi; \
echo "Waiting for $$WEBHOOK_URL/health to return 200... ($$elapsed seconds elapsed)"; \
sleep 1; \
elapsed=$$((elapsed + 1)); \
done; \
echo "Health endpoint is ready! Running acceptance tests"; \
make run-acceptance-tests; \
)
run-integration-tests:
cd tests && pnpm run integration
update-openapi-spec:
@echo "Running the example server to update the openapi docs" && \
( \
echo "Starting the example server"; \
make run-example-server & \
server_pid=$$!; \
trap 'kill $$server_pid' EXIT INT TERM; \
WEBHOOK_URL=$${WEBHOOK_URL:-http://localhost:8080}; \
echo "Using WEBHOOK_URL=$$WEBHOOK_URL"; \
timeout=120; \
elapsed=0; \
while ! curl -s -o /dev/null -w "%{http_code}" $$WEBHOOK_URL/health | grep -q "200"; do \
if [ $$elapsed -ge $$timeout ]; then \
echo "Server health check timed out after $$timeout seconds"; \
kill $$server_pid; \
exit 1; \
fi; \
echo "Waiting for $$WEBHOOK_URL/health to return 200... ($$elapsed seconds elapsed)"; \
sleep 1; \
elapsed=$$((elapsed + 1)); \
done; \
echo "Health endpoint is ready! fetching the specs"; \
curl -s $$WEBHOOK_URL/api-doc/openapi.json | jq > openapi/openapi.json; \
)