Docker container to make runtime and platforms tests easy
🐳 📦 🚀
🏠 Homepage
✨ Demo
Available images for test
docker run -it -p 8080:8080 fidelissauro/chip:v1 Compile Go Binary (Without Docker)
go get -u
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .Run tests
go testSetup Development Environment
- Development environment uses air project to execute live reload on
.gofiles.
docker-compose up --force-recreateBuild image
docker build -it chipUsage
docker run -it -p 8080:8080 msfidelis/chip:v1Swagger
check on http://localhost:8080/swagger/index.html
Endpoints
Healthcheck Endpoint
Common healthcheck, dummy mock
curl 0.0.0.0:8080/healthcheck -i
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Sat, 30 May 2020 22:43:11 GMT
Content-Length: 14
{"status":200}Healthcheck Endpoint (Error)
Simulate error on Healthcheck
curl 0.0.0.0:8080/healthcheck/error -i
HTTP/1.1 503 Service Unavailable
Content-Type: application/json; charset=utf-8
Date: Sat, 30 May 2020 22:44:35 GMT
Content-Length: 14
{"status":503}Healthcheck with Fault Injection (Random Mode)
Use this for fault injection, circuit breaker, self healing tests on your readiness probe
while true; do curl 0.0.0.0:8080/healthcheck/fault; echo; done
{"status":503}
{"status":503}
{"status":200}
{"status":503}
{"status":503}
{"status":200}
{"status":503}
{"status":200}
{"status":200}
{"status":503}
{"status":503}
{"status":200}
{"status":200}
{"status":200}
{"status":200}
{"status":503}
{"status":200}
{"status":200}
{"status":200}Healthcheck with Fault Injection (Soft Mode)
Cause ocasional failure in your probe
while true; do curl 0.0.0.0:8080/healthcheck/fault/soft; echo; done
{"status":200}
{"status":200}
{"status":200}
{"status":200}
{"status":200}
{"status":200}
{"status":200}
{"status":200}
{"status":200}
{"status":200}
{"status":503}
{"status":200}
{"status":200}
{"status":503}Version
This endpoint return different values in accord to tag version, v1, v2, v1-blue, v1-green, v2-blue and v2-green. Ideal to tests deployment scenarios behavior, like rollout, canary, blue / green etc
curl 0.0.0.0:8080/version -i
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Sun, 31 May 2020 03:38:21 GMT
Content-Length: 16
{"version":"v1"}System Info
Retrieve some system info. Use this to test memory, cpu limits and isolation. Host name for load balancing tests and etc.
curl 0.0.0.0:8080/system -i
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Sun, 31 May 2020 03:33:12 GMT
Content-Length: 76
{"hostname":"21672316d98d","cpus":2,"os":"","hypervisor":"bhyve","memory":0}Dump Environment Variables
curl http://0.0.0.0:8080/system/environment -i
[
"HOSTNAME=78339a8484d4",
"HOME=/root",
"ENVIRONMENT=dev",
"PATH=/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"GOPATH=/go",
"PWD=/go/src/chip",
"GOLANG_VERSION=1.13.11"
]Reflection (In Progress)
Use this endpoint to retrieve request headers, body, querystrings, cookies, etc. Ideal to tests API Gateway, CDN, Proxys, Load Balancers transformations on request. Available for all HTTP methods
curl -X GET 0.0.0.0:8080/reflect -i
{
"method": "GET",
"params": "",
"headers": {
"Accept": [
"*/*"
],
"User-Agent": [
"curl/7.64.1"
]
},
"cookies": [],
"body": "",
"path": "/reflection"
}curl -X POST "0.0.0.0:8080/reflection?id=1" -H "Header-Foo: Bar" -d '{"foo":"bar"}' | jq .
{
"method": "POST",
"params": "id=1",
"headers": {
"Accept": [
"*/*"
],
"Content-Length": [
"13"
],
"Content-Type": [
"application/x-www-form-urlencoded"
],
"Header-Foo": [
"Bar"
],
"User-Agent": [
"curl/7.64.1"
]
},
"cookies": [],
"body": "{\"foo\":\"bar\"}",
"path": "/reflection"
}Load
Use this endpoint to consume some CPU resources. Ideal to test auto scale policies, isolation, monitoring and alerts behaviors.
Danger
curl -X GET 0.0.0.0:8080/burn/cpu -i
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Tue, 02 Jun 2020 04:42:24 GMT
Content-Length: 20
{"status":"On Fire"}curl -X GET 0.0.0.0:8080/burn/ram -i
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Tue, 02 Jun 2020 04:42:24 GMT
Content-Length: 20
{"status":"On Fire"}Check ACL and Connection to Ports
Check connection between container environment / namespace and services and another applications
curl -X GET 0.0.0.0:8080/ping/google.com/80 -i
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Mon, 20 Jul 2020 16:04:02 GMT
Content-Length: 71
{"host":"google.com","port":"80","protocol":"tcp","status":"connected"}Author
- Website: https://raj.ninja
- Twitter: @fidelissauro
- Github: @msfidelis
- LinkedIn: @msfidelis
🤝 Contributing
Contributions, issues and feature requests are welcome!
Feel free to check issues page.
Show your support
Give a
📝 License
Copyright © 2020 Matheus Fidelis.
This project is MIT licensed.
This README was generated with
