Skip to content

Commit

Permalink
Readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
tsebastiani committed May 9, 2024
1 parent 466cfb2 commit 2c67571
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 2 deletions.
57 changes: 56 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,56 @@
# krkn-service-hijacking
# Service Hijacking Mock Webservice

This is the mock webservice used in the [Krkn](https://github.com/krkn-chaos/krkn) Service Hijacking
scenario.
This webservice, based on [Flask](https://flask.palletsprojects.com/en/3.0.x/) dinamycally loads a time-based test plan
with the following syntax:

```yaml
- resource: /list/index.php
steps:
GET:
- duration: 15
status: 500
mime_type: application/json
payload: |
{
"status":"internal server error"
}
- duration: 15
status: 201
mime_type: application/json
payload: |
{
"status":"resource created"
}
POST:
- duration: 15
status: 401
mime_type: application/json
payload: |
{
"status": "unauthorized"
}
- duration: 15
status: 404
mime_type: text/plain
payload: not found
- resource: /patch
steps:
PATCH:
- duration: 15
status: 201
mime_type: text/plain
payload: resource patched
- duration: 15
status: 400
mime_type: text/plain
payload: bad request

```

the webservice loads two environment variables:
- `TEST_PLAN_PATH`: (mandatory) is the path in the filesystem where the test plan is located. Krkn mounts it to
the pod deployed using a `ConfigMap`
- `STATS_ROUTE`: (optional, default `/krkn-stats`) overrides the default route of resource that prints the chaos run statistics
in case of a conflict with the test plan
2 changes: 1 addition & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
stats_endpoint = (
os.environ.get("STATS_ROUTE")
if os.environ.get("STATS_ROUTE")
else "/stats"
else "/krkn-stats"
)


Expand Down

0 comments on commit 2c67571

Please sign in to comment.