Skip to content

Repository files navigation

GAOS

HTTP mocking to test API services for chaos scenarios

Apache 2.0Go ReportBuild StatusGitHub release


Gaos, can create and provide custom mock restful services via using your fully-customizable scenarios and runs them on Docker & Kubernetes & localhost flawlessly.

Warning: Currently in Beta.

asciicast

Features

  • API response mocking
  • Custom behaviour scenarios
  • Create custom actions for each scenario
  • Robust routing
  • Serve static & dynamic responses
  • Duration, Latency, Error scenarios
  • Deploy your services on Docker & K8S
  • ... and much more, explore the Gaos!

Installation

  • Via HomeBrew
$ brew tap trendyol/trendyol-tap
$ brew install gaos
  • Via Go
$ go get -u github.com/Trendyol/gaos 
  • Build on Docker
$ make build

Scenarios

ScenarioExplanation
latencyAdds extra latency for request
durationAdds duration limit for request
spanExecutes accept if in the specified time range, ignore otherwise.
rateExecutes ignore if reaches the value or on multiples of, accept otherwise.

Actions

ActionExplanation
acceptExecute if span and rate conditions doesn't match in the specified scenario
ignoreExecute if span and rate conditions does match in the specified scenario
directSpecifies which scenario should be handled by next request
resultSpecifies Result Type that will be return eventually
statusSpecifies Status Code for given Result Type

Results

ResultExplanation
typeResult Type of the content
contentDefinitions the relevant result's content, according to Result Type

Result Type

Result TypeExplanation
staticReturns json content
fileReturns content.type after reading the file in content.path
redirectSends request to remote content.host and awaits response (reverse proxy)

Usage

Usage:
gaos [command]
Available Commands:
help Help about any command
run Run Gaos server on localhost
start Start Gaos server on given engine (Docker, K8S)
Flags:
-h, --help helpfor gaos

Run Command

Run Gaos server on your localhost
Usage:
gaos run [flags]
Flags:
-x, --execute string execute scenario services
-s, --scenario string scenario file input (default "./scenario.json")

Example:

$ gaos run -s ./examples/example.json

After Gaos server started:

$ go run ./examples/example.go

Start Command

Start Gaos server on given engine (Docker, K8S)
Usage:
gaos start [flags]
Flags:
-c, --config string choose k8s config (default "minikube")
--cpu string cpu limit (default "500m")
-e, --environment string gaos running environment {docker, k8s} (default "local")
--memory string memory limit (default "500mi")
-n, --namespace string choose namespace (default "default")
-p, --password string image registry password
-r, --registry string image registry
--replica string replica count (default "1")
-s, --scenario string scenario file input (default "./scenario.json")
--secret string secret key name
-t, --timeout string client timeout (default "5m")
-u, --username string image registry username
  • Example: Docker
$ gaos start -e docker -s './examples/example.json'
  • Example: Kubernetes
$ gaos start -e k8s -s './examples/example.json'

Running Tests

Requirements:

$ bats e2e.bats

Known Issues

  • Lack of some unit tests
  • E2E tests are not running on pipeline yet. (Manually: bats e2e.bats)
  • Not tested in Windows yet

TO-DO

  • Add ./docs folder for better documentation
  • Scenario linter - to check rules, keys and paths
  • Remote server config reader
  • API client
  • Envoy support - sidecar feature
  • Consul support - service mesh feature

License

The base project code is licensed under Apache License unless otherwise specified. Please see the LICENSE file for more information.

GAOS

About

HTTP mocking to test API services for chaos scenarios

Topics

Resources

Stars

212 stars

Watchers

21 watching

Forks

Releases

Packages

Used by

Contributors

Languages