{"id":15322785,"url":"https://github.com/msfidelis/chip","last_synced_at":"2026-03-08T02:04:41.778Z","repository":{"id":45026118,"uuid":"268146138","full_name":"msfidelis/chip","owner":"msfidelis","description":":package: :whale: :rocket:  -  Smart \"dummy\" mock for cloud native tests","archived":false,"fork":false,"pushed_at":"2025-01-10T11:59:16.000Z","size":181,"stargazers_count":23,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-28T14:22:18.132Z","etag":null,"topics":["cloud","cloud-native","docker","docker-image","docker-swarm","fault-injection","healthcheck","healthcheck-endpoint","http","kubernetes","mock","nomad"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/msfidelis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-30T19:26:43.000Z","updated_at":"2025-03-10T14:20:49.000Z","dependencies_parsed_at":"2024-05-17T22:26:19.269Z","dependency_job_id":"885aaf32-61db-4c7d-9043-d94251f032cc","html_url":"https://github.com/msfidelis/chip","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msfidelis%2Fchip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msfidelis%2Fchip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msfidelis%2Fchip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msfidelis%2Fchip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/msfidelis","download_url":"https://codeload.github.com/msfidelis/chip/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248995101,"owners_count":21195497,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloud","cloud-native","docker","docker-image","docker-swarm","fault-injection","healthcheck","healthcheck-endpoint","http","kubernetes","mock","nomad"],"created_at":"2024-10-01T09:17:58.282Z","updated_at":"2026-03-08T02:04:36.726Z","avatar_url":"https://github.com/msfidelis.png","language":"Go","readme":"\u003cp\u003e\u003cimg alt=\"Version\" src=\"./.github/images/logo.png\" /\u003e\u003c/p\u003e\n\u003cp\u003e\n  \u003cimg alt=\"Version\" src=\"https://img.shields.io/badge/version-0-blue.svg?cacheSeconds=2592000\" /\u003e\n  \u003ca href=\"/README.md\" target=\"_blank\"\u003e\n    \u003cimg alt=\"Documentation\" src=\"https://img.shields.io/badge/documentation-yes-brightgreen.svg\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"LICENSE\" target=\"_blank\"\u003e\n    \u003cimg alt=\"License: MIT\" src=\"https://img.shields.io/badge/License-MIT-yellow.svg\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://twitter.com/fidelissauro\" target=\"_blank\"\u003e\n    \u003cimg alt=\"Twitter: fidelissauro\" src=\"https://img.shields.io/twitter/follow/fidelissauro.svg?style=social\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003e Docker container to make runtime and platforms tests easy :whale: :package: :rocket:\n\n### 🏠 [Homepage](/)\n\n### ✨ [Demo](/)\n\n#### Available images for test \n\n* [v1]()\n* [v2]()\n* [latest]()\n\n```sh\ndocker run -it -p 8080:8080 fidelissauro/chip:v1 \n```\n\n\n## Compile Go Binary (Without Docker)\n\n```sh\ngo get -u\nCGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .\n```\n\n## Run tests\n\n```sh\ngo test\n```\n\n## Setup Development Environment\n\n* Development environment uses [air project](https://github.com/cosmtrek/air) to execute live reload on `.go` files.\n\n```sh\ndocker-compose up --force-recreate\n```\n\n## Build image\n\n```sh\ndocker build -it chip\n```\n\n## Usage\n\n```sh\ndocker run -it -p 8080:8080 msfidelis/chip:v1\n```\n\n## Swagger\n\ncheck on http://localhost:8080/swagger/index.html\n\n\n# Endpoints\n\n\n## Healthcheck Endpoint\n\nCommon healthcheck, dummy mock\n\n```sh\ncurl 0.0.0.0:8080/healthcheck -i\n\nHTTP/1.1 200 OK\nContent-Type: application/json; charset=utf-8\nDate: Sat, 30 May 2020 22:43:11 GMT\nContent-Length: 14\n\n{\"status\":200}\n```\n\n## Healthcheck Endpoint (Error)\n\nSimulate error on Healthcheck\n\n```sh\ncurl 0.0.0.0:8080/healthcheck/error -i\n\nHTTP/1.1 503 Service Unavailable\nContent-Type: application/json; charset=utf-8\nDate: Sat, 30 May 2020 22:44:35 GMT\nContent-Length: 14\n\n{\"status\":503}\n```\n\n## Healthcheck with Fault Injection (Random Mode)\n\nUse this for fault injection, circuit breaker, self healing tests on your readiness probe\n\n```sh\nwhile true; do curl 0.0.0.0:8080/healthcheck/fault; echo;  done\n\n{\"status\":503}\n{\"status\":503}\n{\"status\":200}\n{\"status\":503}\n{\"status\":503}\n{\"status\":200}\n{\"status\":503}\n{\"status\":200}\n{\"status\":200}\n{\"status\":503}\n{\"status\":503}\n{\"status\":200}\n{\"status\":200}\n{\"status\":200}\n{\"status\":200}\n{\"status\":503}\n{\"status\":200}\n{\"status\":200}\n{\"status\":200}\n```\n\n## Healthcheck with Fault Injection (Soft Mode)\n\nCause ocasional failure in your probe\n\n```sh\nwhile true; do curl 0.0.0.0:8080/healthcheck/fault/soft; echo;  done\n\n{\"status\":200}\n{\"status\":200}\n{\"status\":200}\n{\"status\":200}\n{\"status\":200}\n{\"status\":200}\n{\"status\":200}\n{\"status\":200}\n{\"status\":200}\n{\"status\":200}\n{\"status\":503}\n{\"status\":200}\n{\"status\":200}\n{\"status\":503}\n```\n\n## Liveness Probe OK\n\nFor Liveness tests\n\n```sh\ncurl 0.0.0.0:8080/liveness -i\nHTTP/1.1 200 OK\nContent-Type: application/json; charset=utf-8\nDate: Sat, 08 May 2021 14:00:05 GMT\nContent-Length: 17\n\n{\"status\":\"Live\"}\n```\n\n## Liveness Probe with intentional failure\n\n```sh \ncurl 0.0.0.0:8080/liveness/error -i\nHTTP/1.1 503 Service Unavailable\nContent-Type: application/json; charset=utf-8\nDate: Sat, 08 May 2021 14:01:08 GMT\nContent-Length: 17\n\n{\"status\":\"Dead\"}\n```\n\n## Readiness\n\nFor readiness tests\n\n```sh \ncurl 0.0.0.0:8080/readiness -i\nHTTP/1.1 200 OK\nContent-Type: application/json; charset=utf-8\nDate: Sat, 08 May 2021 14:02:02 GMT\nContent-Length: 18\n\n{\"status\":\"Ready\"}\n```\n\n* You can set the environment variable  `READINESS_PROBE_MOCK_TIME_IN_SECONDS` to customize your readiness probe in seconds for testing. Default is 5 seconds. \n\n## Liveness Probe with intentional failure\n\n```sh\ncurl 0.0.0.0:8080/readiness/error -i\nHTTP/1.1 503 Service Unavailable\nContent-Type: application/json; charset=utf-8\nDate: Sat, 08 May 2021 14:02:37 GMT\nContent-Length: 22\n\n{\"status\":\"Not Ready\"}\n```\n\n## Version\n\nThis 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.\n\nThis variable can be customized using environment variable called `VERSION``\n\n```sh\nexport VERSION=v3\n```\n\n```sh\ncurl 0.0.0.0:8080/version -i\n\nHTTP/1.1 200 OK\nContent-Type: application/json; charset=utf-8\nDate: Sun, 31 May 2020 03:38:21 GMT\nContent-Length: 16\n\n{\"version\":\"v1\"}\n```\n\n\n## System Info \nRetrieve some system info. Use this to test memory, cpu limits and isolation. Host name for load balancing tests and etc.\n\n```sh\ncurl 0.0.0.0:8080/system -i\n\nHTTP/1.1 200 OK\nContent-Type: application/json; charset=utf-8\nDate: Sun, 31 May 2020 03:33:12 GMT\nContent-Length: 76\n\n{\"hostname\":\"21672316d98d\",\"cpus\":2,\"os\":\"\",\"hypervisor\":\"bhyve\",\"memory\":0}\n```\n\n## Dump Environment Variables\n\n```sh\ncurl http://0.0.0.0:8080/system/environment -i  \n\n[\n  \"HOSTNAME=78339a8484d4\",\n  \"HOME=/root\",\n  \"ENVIRONMENT=dev\",\n  \"PATH=/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\",\n  \"GOPATH=/go\",\n  \"PWD=/go/src/chip\",\n  \"GOLANG_VERSION=1.13.11\"\n]\n```\n\n## Reflection (In Progress)\n\nUse 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\n\n```sh\ncurl -X GET 0.0.0.0:8080/reflect -i\n\n{\n  \"method\": \"GET\",\n  \"params\": \"\",\n  \"headers\": {\n    \"Accept\": [\n      \"*/*\"\n    ],\n    \"User-Agent\": [\n      \"curl/7.64.1\"\n    ]\n  },\n  \"cookies\": [],\n  \"body\": \"\",\n  \"path\": \"/reflection\"\n}\n```\n\n## Proxy Request \n\nUse this endpoint to proxy HTTP requests betweet chip and another endpoint \n\n\n```sh\ncurl --location --request POST 'http://0.0.0.0:8080/proxy' \\                                                     ─╯\n--header 'Content-Type: application/json' \\\n--data-raw '{\n    \"method\": \"GET\",\n    \"host\": \"https://google.com.br/\",\n    \"path\": \"/whoami\",\n    \"headers\": [\n        {\n            \"name\": \"content-type\",\n            \"value\": \"application/json\"\n        },\n        {\n            \"name\": \"foo\",\n            \"value\": \"bar\"\n        }\n    ],\n    \"body\": \"{\\\"vai\\\": \\\"sim\\\"}\"\n}' \n```\n\n```sh\ncurl -X POST \"0.0.0.0:8080/reflection?id=1\" -H \"Header-Foo: Bar\" -d '{\"foo\":\"bar\"}' | jq .\n\n{\n  \"method\": \"POST\",\n  \"params\": \"id=1\",\n  \"headers\": {\n    \"Accept\": [\n      \"*/*\"\n    ],\n    \"Content-Length\": [\n      \"13\"\n    ],\n    \"Content-Type\": [\n      \"application/x-www-form-urlencoded\"\n    ],\n    \"Header-Foo\": [\n      \"Bar\"\n    ],\n    \"User-Agent\": [\n      \"curl/7.64.1\"\n    ]\n  },\n  \"cookies\": [],\n  \"body\": \"{\\\"foo\\\":\\\"bar\\\"}\",\n  \"path\": \"/reflection\"\n}\n```\n\n\n## Load\n\nUse this endpoint to consume some CPU resources. Ideal to test auto scale policies, isolation, monitoring and alerts behaviors.\n\n\u003e Danger\n\n```sh \ncurl -X GET 0.0.0.0:8080/burn/cpu -i\n\nHTTP/1.1 200 OK\nContent-Type: application/json; charset=utf-8\nDate: Tue, 02 Jun 2020 04:42:24 GMT\nContent-Length: 20\n\n{\"status\":\"On Fire\"}\n```\n\n```sh \ncurl -X GET 0.0.0.0:8080/burn/ram -i\n\nHTTP/1.1 200 OK\nContent-Type: application/json; charset=utf-8\nDate: Tue, 02 Jun 2020 04:42:24 GMT\nContent-Length: 20\n\n{\"status\":\"On Fire\"}\n```\n\n## Check ACL and Connection to Ports\n\nCheck connection between container environment / namespace and services and another applications\n\n\n```sh\ncurl -X GET 0.0.0.0:8080/ping/google.com/80 -i\n\nHTTP/1.1 200 OK\nContent-Type: application/json; charset=utf-8\nDate: Mon, 20 Jul 2020 16:04:02 GMT\nContent-Length: 71\n\n{\"host\":\"google.com\",\"port\":\"80\",\"protocol\":\"tcp\",\"status\":\"connected\"}\n```\n\n## Logging Events \n\nSent a log of logs to stdout. Sent querystring `events` to customize the number of logs; Default `1000`.\n\n```sh\ncurl -X GET \"0.0.0.0:8080/logging?events=2000\" -i \n\nHTTP/1.1 200 OK\nContent-Type: application/json; charset=utf-8\nDate: Sat, 28 Aug 2021 14:50:41 GMT\nContent-Length: 61\n\n{\"status\":200,\"message\":\"2000 logging events sent to stdout\"}\n```\n\n## Filesystem\n\nList some directory contents \n\n```bash\ncurl -X POST \"0.0.0.0:8080/filesystem/ls\" -i -d '{\"path\": \"./\"}'\n\nHTTP/1.1 200 OK\nContent-Type: application/json; charset=utf-8\nDate: Fri, 10 Jan 2025 11:52:26 GMT\nContent-Length: 86\n\n{\"path\":\"./\",\"files\":[\".dockerenv\",\"dev\",\"etc\",\"lib\",\"main\",\"proc\",\"sys\",\"tmp\",\"var\"]}\n```\n\nWrite file - base64 content\n\n```bash\ncurl -X POST \"0.0.0.0:8080/filesystem/write\" -i -d '{\"path\": \"./test\", \"content\": \"V3JpdGUgVGVzdAo=\"}';\n\nHTTP/1.1 202 Accepted\nContent-Type: application/json; charset=utf-8\nDate: Fri, 10 Jan 2025 11:58:13 GMT\nContent-Length: 42\n\n{\"message\":\"file written\",\"path\":\"./test\"}\n```\n\nRead files on filesystem \n\n```bash\ncurl -X POST \"0.0.0.0:8080/filesystem/cat\" -i -d '{\"path\": \"./test\"}';\n\nHTTP/1.1 200 OK\nContent-Type: text/plain; charset=utf-8\nDate: Fri, 10 Jan 2025 11:58:44 GMT\nContent-Length: 11\n\nWrite Test\n```\n\nDelete files on filesystem \n\n```bash\ncurl -X DELETE \"0.0.0.0:8080/filesystem/delete\" -i -d '{\"path\": \"./test\"}';\n\nHTTP/1.1 200 OK\nContent-Type: application/json; charset=utf-8\nDate: Fri, 10 Jan 2025 11:59:01 GMT\nContent-Length: 26\n\n{\"message\":\"file deleted\"}\n```\n\n## Whoami? \n\n```sh\ncurl -X GET 0.0.0.0:8080/whoami -i \n\nHTTP/1.1 418 I'm a teapot\nContent-Type: text/plain; charset=utf-8\nDate: Sun, 23 May 2021 00:53:46 GMT\nContent-Length: 85\n\n\n             ;,'\n     _o_    ;:;'\n ,-.'---`.__ ;\n((j`=====',-'\n `-\\     /\n    `-=-'\n```\n\n## Author\n\n👤 **Matheus Fidelis**\n\n* Website: https://raj.ninja\n* Twitter: [@fidelissauro](https://twitter.com/fidelissauro)\n* Github: [@msfidelis](https://github.com/msfidelis)\n* LinkedIn: [@msfidelis](https://linkedin.com/in/msfidelis)\n\n## 🤝 Contributing\n\nContributions, issues and feature requests are welcome!\u003cbr /\u003eFeel free to check [issues page](/issues). \n\n## Show your support\n\nGive a ⭐️ if this project helped you!\n\n## 📝 License\n\nCopyright © 2020 [Matheus Fidelis](https://github.com/msfidelis).\u003cbr /\u003e\nThis project is [MIT](LICENSE) licensed.\n\n***\n_This README was generated with ❤️ by [readme-md-generator](https://github.com/kefranabg/readme-md-generator)_\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsfidelis%2Fchip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmsfidelis%2Fchip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsfidelis%2Fchip/lists"}