Skip to content

Commit 6c9cfb3

Browse files
committed
Configure MockServer level log and expectations
1 parent 5efca72 commit 6c9cfb3

File tree

3 files changed

+112
-2
lines changed

3 files changed

+112
-2
lines changed

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ help: ## Display this help
1111
install: composer-install up ## Install required software and initialize your local configuration
1212

1313
up: ## Start application containers and required services
14-
@docker-compose up -d
14+
@bash -c "export MOCKSERVER_LOG_LEVEL=WARN; docker-compose up -d"
15+
16+
debug: ## Start application containers and required services
17+
@bash -c "export MOCKSERVER_LOG_LEVEL=INFO; docker-compose up -d"
1518

1619
down: ## Stop application containers and required services
1720
@docker-compose down

docker-compose.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ services:
99
- .:/app
1010
tty: true
1111
mockserver:
12+
container_name: mockserver
1213
image: mockserver/mockserver
14+
environment:
15+
MOCKSERVER_INITIALIZATION_JSON_PATH: /expectations/**.json
16+
MOCKSERVER_LOG_LEVEL: ${MOCKSERVER_LOG_LEVEL}
1317
ports:
14-
- "1080:1080"
18+
- "1080:1080"
19+
volumes:
20+
- ./docker/mockserver/expectations:/expectations
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
{
2+
"id": "get-post-1",
3+
"httpRequest": {
4+
"method": "GET",
5+
"path": "/posts/1",
6+
"headers": {
7+
"content-length": [
8+
"0"
9+
],
10+
"User-Agent": [
11+
"GuzzleHttp/7"
12+
],
13+
"Host": [
14+
"jsonplaceholder.typicode.com"
15+
]
16+
},
17+
"keepAlive": true,
18+
"secure": true,
19+
"protocol": "HTTP_1_1",
20+
"localAddress": "localhost/127.0.0.1:1080",
21+
"remoteAddress": "127.0.0.1:35156"
22+
},
23+
"httpResponse": {
24+
"statusCode": 200,
25+
"reasonPhrase": "OK",
26+
"headers": {
27+
"alt-svc": [
28+
"h3=\":443\"; ma=86400, h3-29=\":443\"; ma=86400"
29+
],
30+
"X-Ratelimit-Reset": [
31+
"1663541001"
32+
],
33+
"X-Ratelimit-Remaining": [
34+
"999"
35+
],
36+
"X-Ratelimit-Limit": [
37+
"1000"
38+
],
39+
"X-Powered-By": [
40+
"Express"
41+
],
42+
"X-Content-Type-Options": [
43+
"nosniff"
44+
],
45+
"Via": [
46+
"1.1 vegur"
47+
],
48+
"Vary": [
49+
"Origin, Accept-Encoding"
50+
],
51+
"Server-Timing": [
52+
"cf-q-config;dur=3.999999989901e-06"
53+
],
54+
"Server": [
55+
"cloudflare"
56+
],
57+
"Report-To": [
58+
"{\"endpoints\":[{\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=8bXL92eq%2BaEEjrC7gOV1Q4BBYz%2F18b9cuz%2Bm59VP4iUzDEjH9G2uxRK%2BxKIr6xoYfxmrmTqybLrsyYpmEZVf0IzSMfA7XizRycbnUCkM67ezH0PH6jGfb5%2FEMv8NX%2F6AusKf%2FqhFab1HWvcD5ZrD\"}],\"group\":\"cf-nel\",\"max_age\":604800}"
59+
],
60+
"Pragma": [
61+
"no-cache"
62+
],
63+
"NEL": [
64+
"{\"success_fraction\":0,\"report_to\":\"cf-nel\",\"max_age\":604800}"
65+
],
66+
"Expires": [
67+
"-1"
68+
],
69+
"Etag": [
70+
"W/\"124-yiKdLzqO5gfBrJFrcdJ8Yq0LGnU\""
71+
],
72+
"Date": [
73+
"Sat, 04 Feb 2023 07:40:35 GMT"
74+
],
75+
"Content-Type": [
76+
"application/json; charset=utf-8"
77+
],
78+
"Cache-Control": [
79+
"max-age=43200"
80+
],
81+
"CF-RAY": [
82+
"7941c252df112f93-MAD"
83+
],
84+
"CF-Cache-Status": [
85+
"HIT"
86+
],
87+
"Age": [
88+
"25601"
89+
],
90+
"Access-Control-Allow-Credentials": [
91+
"true"
92+
]
93+
},
94+
"body": {
95+
"userId": 1,
96+
"id": 1,
97+
"title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
98+
"body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"
99+
}
100+
}
101+
}

0 commit comments

Comments
 (0)