-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: NPG-2188 added mock farm to vitup.It should allow to start m…
…ultiple mocks at one machine + give user some control over starting and stopping particular mock
- Loading branch information
Showing
21 changed files
with
896 additions
and
11 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
{ | ||
"info": { | ||
"_postman_id": "a54a9a24-ef93-48b5-a447-09a5d61d5075", | ||
"name": "Mock Farm", | ||
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", | ||
"_exporter_id": "11181958" | ||
}, | ||
"item": [ | ||
{ | ||
"name": "List all active environments", | ||
"request": { | ||
"method": "GET", | ||
"header": [], | ||
"url": { | ||
"raw": "https://127.0.0.1:7070/api/v0/active", | ||
"protocol": "https", | ||
"host": [ | ||
"127", | ||
"0", | ||
"0", | ||
"1" | ||
], | ||
"port": "7070", | ||
"path": [ | ||
"api", | ||
"v0", | ||
"active" | ||
] | ||
} | ||
}, | ||
"response": [] | ||
}, | ||
{ | ||
"name": "Start new environment with name 'marek' and port = 10010", | ||
"request": { | ||
"method": "POST", | ||
"header": [], | ||
"url": { | ||
"raw": "https://127.0.0.1:7070/api/v0/start/darek", | ||
"protocol": "https", | ||
"host": [ | ||
"127", | ||
"0", | ||
"0", | ||
"1" | ||
], | ||
"port": "7070", | ||
"path": [ | ||
"api", | ||
"v0", | ||
"start", | ||
"darek" | ||
] | ||
} | ||
}, | ||
"response": [] | ||
}, | ||
{ | ||
"name": "Shutdown existing environment with name 'marek'", | ||
"request": { | ||
"method": "POST", | ||
"header": [], | ||
"url": { | ||
"raw": "https://127.0.0.1:7070/api/v0/start/marek/10010", | ||
"protocol": "https", | ||
"host": [ | ||
"127", | ||
"0", | ||
"0", | ||
"1" | ||
], | ||
"port": "7070", | ||
"path": [ | ||
"api", | ||
"v0", | ||
"start", | ||
"marek", | ||
"10010" | ||
] | ||
} | ||
}, | ||
"response": [] | ||
}, | ||
{ | ||
"name": "Shutdown existing environment with name 'marek'", | ||
"request": { | ||
"method": "POST", | ||
"header": [], | ||
"url": { | ||
"raw": "https://127.0.0.1:7070/api/v0/shutdown/marek", | ||
"protocol": "https", | ||
"host": [ | ||
"127", | ||
"0", | ||
"0", | ||
"1" | ||
], | ||
"port": "7070", | ||
"path": [ | ||
"api", | ||
"v0", | ||
"shutdown", | ||
"marek" | ||
] | ||
} | ||
}, | ||
"response": [] | ||
} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
openapi: 3.0.2 | ||
|
||
info: | ||
title: Mock farm REST API | ||
description: Mock Farm Rest API v0 | ||
version: 0.0.1 | ||
contact: | ||
url: 'https://github.com/input-output-hk/vit-testing/' | ||
|
||
servers: | ||
- url: 'https://localhost' | ||
|
||
tags: | ||
- name: active | ||
- name: start | ||
- name: shutdown | ||
|
||
paths: | ||
'/api/v0/active': | ||
get: | ||
description: Lists active mock environments | ||
operationId: Active | ||
tags: | ||
- active | ||
responses: | ||
'200': | ||
description: Success | ||
content: | ||
application/json: | ||
schema: | ||
description: assigned port number | ||
type: string | ||
format: text | ||
'400': | ||
description: Mock env with given ID or port already exists | ||
|
||
'/api/v0/start/{env_name}': | ||
post: | ||
description: Starts new mock env with random free port | ||
operationId: StartEnvRandomPort | ||
tags: | ||
- start | ||
parameters: | ||
- name: env_name | ||
in: path | ||
required: true | ||
schema: | ||
description: Environment name | ||
type: string | ||
pattern: '[0-9a-f]+' | ||
responses: | ||
'200': | ||
description: Success | ||
content: | ||
application/json: | ||
schema: | ||
description: assigned port number | ||
type: string | ||
format: text | ||
'400': | ||
description: Mock env with given ID or port already exists | ||
|
||
'/api/v0/start/{env_name}/{port}': | ||
post: | ||
description: Starts new mock env with random free port | ||
operationId: StartEnv | ||
tags: | ||
- start | ||
parameters: | ||
- name: env_name | ||
in: path | ||
required: true | ||
schema: | ||
description: Environment name | ||
type: string | ||
pattern: '[0-9a-f]+' | ||
responses: | ||
'200': | ||
description: Success | ||
content: | ||
application/json: | ||
schema: | ||
description: assigned port number | ||
type: string | ||
format: text | ||
'400': | ||
description: Mock env with given ID or port already exists | ||
|
||
'/api/v0/shutdown/{env_name}': | ||
post: | ||
description: Shutdown new mock env with random free port | ||
operationId: ShutdownEnv | ||
tags: | ||
- shutdown | ||
parameters: | ||
- name: env_name | ||
in: path | ||
required: true | ||
schema: | ||
description: Environment name | ||
type: string | ||
pattern: '[0-9a-f]+' | ||
responses: | ||
'200': | ||
description: Success | ||
content: | ||
application/json: | ||
schema: | ||
description: assigned port number | ||
type: string | ||
format: text | ||
'404': | ||
description: Mock env with given ID was not found |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
## Mock Farm | ||
|
||
Mock farm is a simple extension for mock service. It allows to run more that one mock at once and give more control to user in term of starting and stopping particular mock instance. | ||
|
||
### Configuration | ||
|
||
This section describe configuration file which can be passed as argument for snapshot service: | ||
|
||
- `port`: port on which registration-service will be exposed, | ||
- `working_directory`: path to folder which config files will be dumped, | ||
- `mocks-port-range`: range of ports assigned for usage, | ||
- `protocol`: decide whether mock farm should be exposed as http or https, | ||
- `local`: should service be exposed on all network interfaces or only 127.0.0.1, | ||
- `token`: token limiting access to environment. Must be provided in header `API-Token` for each request | ||
|
||
Note: it is recommended to run command from `vit-testing/vitup` folder (then no explicit paths are required to be provided). | ||
Configuration file example is available under `vit-testing/vitup/example/mock-farm/config.yaml` | ||
|
||
### Start | ||
|
||
`vitup start mock-farm --config example\mock\mock-farm\config.yaml` | ||
|
||
### Documentation | ||
|
||
- [OpenApi](../api/vitup/mock-farm/v0.yaml) | ||
- [Requests collection](../api/vitup/mock-farm/postman_collection.json) |
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ | |
/prod/ | ||
/validate/ | ||
/vole.trace | ||
/mock_farm/ |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"port": 7070, | ||
"working_directory": "./mock_farm", | ||
"mocks-port-range": { | ||
"start": 8080, | ||
"end": 9090 | ||
}, | ||
"protocol": { | ||
"key_path": "./resources/tls/server.key", | ||
"cert_path": "./resources/tls/server.crt" | ||
}, | ||
"local": true | ||
} |
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
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
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
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
Oops, something went wrong.