All Projects β†’ msfidelis β†’ chip

msfidelis / chip

Licence: MIT license
πŸ“¦ 🐳 πŸš€ - Smart "dummy" mock for cloud native tests

Programming Languages

go
31211 projects - #10 most used programming language
Dockerfile
14818 projects

Projects that are alternatives of or similar to chip

Litmus
Litmus helps SREs and developers practice chaos engineering in a Cloud-native way. Chaos experiments are published at the ChaosHub (https://hub.litmuschaos.io). Community notes is at https://hackmd.io/a4Zu_sH4TZGeih-xCimi3Q
Stars: ✭ 2,377 (+12410.53%)
Mutual labels:  cloud-native, fault-injection
Istio
Connect, secure, control, and observe services.
Stars: ✭ 28,970 (+152373.68%)
Mutual labels:  nomad, fault-injection
Chaos Mesh
A Chaos Engineering Platform for Kubernetes.
Stars: ✭ 4,265 (+22347.37%)
Mutual labels:  cloud-native, fault-injection
hivemq4-docker-images
Official Docker Images for the Enterprise MQTT Broker HiveMQ
Stars: ✭ 18 (-5.26%)
Mutual labels:  docker-swarm, cloud-native
microservices-demo.github.io
The Microservices Demo website.
Stars: ✭ 65 (+242.11%)
Mutual labels:  docker-swarm, nomad
Gnes
GNES is Generic Neural Elastic Search, a cloud-native semantic search system based on deep neural network.
Stars: ✭ 1,178 (+6100%)
Mutual labels:  docker-swarm, cloud-native
Zenko
Zenko is the open source multi-cloud data controller: own and keep control of your data on any cloud.
Stars: ✭ 353 (+1757.89%)
Mutual labels:  docker-swarm, cloud-native
Container Orchestration Comparison
A comparison of the different container orchestration tools available.
Stars: ✭ 119 (+526.32%)
Mutual labels:  docker-swarm, nomad
mockingbird
🐦 Decorator Powered TypeScript Library for Creating Mocks
Stars: ✭ 70 (+268.42%)
Mutual labels:  mock
logging-operator
A golang based operator to create and manage EFK (Elasticsearch, Fluentd, and Kibana) stack on Kubernetes
Stars: ✭ 42 (+121.05%)
Mutual labels:  cloud-native
if1007
Desenvolvimento de Aplicaçáes com Arquitetura Baseada em Microservices
Stars: ✭ 78 (+310.53%)
Mutual labels:  cloud-native
mocat
🐈 Mocat is a mocking toolbar that allows you to interactively develop and test network requests.
Stars: ✭ 27 (+42.11%)
Mutual labels:  mock
dextool
Suite of C/C++ tooling built on LLVM/Clang
Stars: ✭ 81 (+326.32%)
Mutual labels:  mock
K8STARS
Native Kubernetes Solution for TARS Services
Stars: ✭ 55 (+189.47%)
Mutual labels:  cloud-native
admin-base-tmpl
⚑️基于vite2ζž„ε»Ίηš„vue2+typescript+elementUI ηš„εŽε°εŸΊη‘€ε₯—δ»ΆοΌŒι’„θ§ˆεœ°ε€
Stars: ✭ 52 (+173.68%)
Mutual labels:  mock
DataStore
Visual develop tool of creating mocked Json
Stars: ✭ 30 (+57.89%)
Mutual labels:  mock
ruby-dns-mock
DNS mock server written on πŸ’Ž Ruby. Mimic any DNS records for your test environment with fake DNS server.
Stars: ✭ 50 (+163.16%)
Mutual labels:  mock
juicefs-csi-driver
JuiceFS CSI Driver
Stars: ✭ 117 (+515.79%)
Mutual labels:  cloud-native
kubernetes-automation-toolkit
This repository contains code examples and documentation for learning how applications can be developed with Kubernetes
Stars: ✭ 51 (+168.42%)
Mutual labels:  cloud-native
moq.ts
Moq for Typescript
Stars: ✭ 107 (+463.16%)
Mutual labels:  mock

Version

Version Documentation License: MIT Twitter: fidelissauro

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 test

Setup Development Environment

  • Development environment uses air project to execute live reload on .go files.
docker-compose up --force-recreate

Build image

docker build -it chip

Usage

docker run -it -p 8080:8080 msfidelis/chip:v1

Swagger

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}

Liveness Probe OK

For Liveness tests

curl 0.0.0.0:8080/liveness -i
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Sat, 08 May 2021 14:00:05 GMT
Content-Length: 17

{"status":"Live"}

Liveness Probe with intentional failure

curl 0.0.0.0:8080/liveness/error -i
HTTP/1.1 503 Service Unavailable
Content-Type: application/json; charset=utf-8
Date: Sat, 08 May 2021 14:01:08 GMT
Content-Length: 17

{"status":"Dead"}

Readiness

For readiness tests

curl 0.0.0.0:8080/readiness -i
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Sat, 08 May 2021 14:02:02 GMT
Content-Length: 18

{"status":"Ready"}
  • 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.

Liveness Probe with intentional failure

curl 0.0.0.0:8080/readiness/error -i
HTTP/1.1 503 Service Unavailable
Content-Type: application/json; charset=utf-8
Date: Sat, 08 May 2021 14:02:37 GMT
Content-Length: 22

{"status":"Not Ready"}

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.

This variable can be customized using environment variable called `VERSION``

export VERSION=v3
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"
}

Proxy Request

Use this endpoint to proxy HTTP requests betweet chip and another endpoint

curl --location --request POST 'http://0.0.0.0:8080/proxy' \                                                     ─╯
--header 'Content-Type: application/json' \
--data-raw '{
    "method": "GET",
    "host": "https://google.com.br/",
    "path": "/whoami",
    "headers": [
        {
            "name": "content-type",
            "value": "application/json"
        },
        {
            "name": "foo",
            "value": "bar"
        }
    ],
    "body": "{\"vai\": \"sim\"}"
}' 
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"}

Logging Events

Sent a log of logs to stdout. Sent querystring events to customize the number of logs; Default 1000.

curl -X GET "0.0.0.0:8080/logging?events=2000" -i 

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Sat, 28 Aug 2021 14:50:41 GMT
Content-Length: 61

{"status":200,"message":"2000 logging events sent to stdout"}

Whoami?

curl -X GET 0.0.0.0:8080/whoami -i 

HTTP/1.1 418 I'm a teapot
Content-Type: text/plain; charset=utf-8
Date: Sun, 23 May 2021 00:53:46 GMT
Content-Length: 85


             ;,'
     _o_    ;:;'
 ,-.'---`.__ ;
((j`=====',-'
 `-\     /
    `-=-'

Author

πŸ‘€ Matheus Fidelis

🀝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

πŸ“ License

Copyright Β© 2020 Matheus Fidelis.
This project is MIT licensed.


This README was generated with ❀️ by readme-md-generator

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].