Created
May 23, 2021 22:49
-
-
Save mertyildiran/bdea380df63e7952737c389e5e1bb9f6 to your computer and use it in GitHub Desktop.
Mockintosh: mocks for microservice environments - Part 6: Management UI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"id": {{ random.int(100000, 999999) }}, | |
"name": "{{ jsonPath(request.json, '$.name') }}", | |
"address": "{{ jsonPath(request.json, '$.address') }}", | |
"phone": "{{ jsonPath(request.json, '$.phone') }}" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"id": {{ id }}, | |
"firstName": "{{ fake.first_name() }}", | |
"lastName": "{{ fake.last_name() }}", | |
"friends": [{% for n in range(range(5) | random) %} | |
{ | |
"id": {{ random.int(100000, 999999) }} | |
}{% if not loop.last %},{% endif %} | |
{% endfor %}] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"users": [{% for n in range(100) %} | |
{ | |
"id": {{ random.int(100000, 999999) }}, | |
"firstName": "{{ fake.first_name() }}", | |
"lastName": "{{ fake.last_name() }}", | |
"friends": [{% for n in range(range(5) | random) %} | |
{ | |
"id": {{ random.int(100000, 999999) }} | |
}{% if not loop.last %},{% endif %} | |
{% endfor %}] | |
}{% if not loop.last %},{% endif %} | |
{% endfor %}], | |
"total": 10 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
management: | |
port: 8080 | |
templatingEngine: Jinja2 | |
services: | |
- name: Mock for Service1 | |
hostname: service1.example.com | |
port: 8081 | |
endpoints: | |
- path: "/users" | |
method: GET | |
response: | |
headers: | |
Content-Type: "application/json; charset=UTF-8" | |
useTemplating: true | |
body: "@templates/users.json.j2" | |
- path: "/users/{{ id }}" | |
method: GET | |
response: | |
headers: | |
Content-Type: "application/json; charset=UTF-8" | |
useTemplating: true | |
body: "@templates/user.json.j2" | |
- name: Mock for Service2 | |
hostname: service2.example.com | |
port: 8082 | |
endpoints: | |
- path: "/companies" | |
method: POST | |
body: | |
schema: | |
type: object | |
properties: | |
name: | |
type: string | |
address: | |
type: string | |
phone: | |
type: number | |
required: | |
- name | |
response: | |
status: 202 | |
headers: | |
Content-Type: "application/json; charset=UTF-8" | |
useTemplating: true | |
body: "@templates/companies.json.j2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"documents": [ | |
{ | |
"openapi": "3.0.0", | |
"info": { | |
"title": "Mock for Service1", | |
"description": "Automatically generated Open API Specification.", | |
"version": "0.1.9" | |
}, | |
"servers": [ | |
{ | |
"url": "http://service1.example.com:8001", | |
"description": "Mock for Service1" | |
} | |
], | |
"paths": { | |
"/users": { | |
"get": { | |
"responses": { | |
"200": { | |
"description": "" | |
} | |
}, | |
"parameters": [] | |
} | |
}, | |
"/users/{id}": { | |
"get": { | |
"responses": { | |
"200": { | |
"description": "" | |
} | |
}, | |
"parameters": [ | |
{ | |
"in": "path", | |
"name": "id", | |
"required": true, | |
"schema": { | |
"type": "string" | |
} | |
} | |
] | |
} | |
} | |
} | |
}, | |
{ | |
"openapi": "3.0.0", | |
"info": { | |
"title": "Mock for Service2", | |
"description": "Automatically generated Open API Specification.", | |
"version": "0.1.9" | |
}, | |
"servers": [ | |
{ | |
"url": "http://service2.example.com:8002", | |
"description": "Mock for Service2" | |
} | |
], | |
"paths": { | |
"/companies": { | |
"post": { | |
"responses": { | |
"200": { | |
"description": "" | |
} | |
}, | |
"parameters": [] | |
} | |
} | |
} | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"global": { | |
"request_counter": 3, | |
"avg_resp_time": 0.01885875066121419, | |
"status_code_distribution": { | |
"200": 2, | |
"202": 1 | |
} | |
}, | |
"services": [ | |
{ | |
"hint": "http://service1.example.com:8081 - Mock for Service1", | |
"request_counter": 2, | |
"avg_resp_time": 0.016363978385925293, | |
"status_code_distribution": { | |
"200": 2 | |
}, | |
"endpoints": [ | |
{ | |
"hint": "GET /users", | |
"request_counter": 1, | |
"avg_resp_time": 0.025424718856811523, | |
"status_code_distribution": { | |
"200": 1 | |
} | |
}, | |
{ | |
"hint": "GET /users/{{ id }}", | |
"request_counter": 1, | |
"avg_resp_time": 0.0073032379150390625, | |
"status_code_distribution": { | |
"200": 1 | |
} | |
} | |
] | |
}, | |
{ | |
"hint": "http://service2.example.com:8082 - Mock for Service2", | |
"request_counter": 1, | |
"avg_resp_time": 0.023848295211791992, | |
"status_code_distribution": { | |
"202": 1 | |
}, | |
"endpoints": [ | |
{ | |
"hint": "POST /companies", | |
"request_counter": 1, | |
"avg_resp_time": 0.023848295211791992, | |
"status_code_distribution": { | |
"202": 1 | |
} | |
} | |
] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment