HTTP mocking to test API services for chaos scenarios

Overview

GAOS

HTTP mocking to test API services for chaos scenarios

Apache 2.0 Go Report Build Status GitHub 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

Scenario Explanation
latency Adds extra latency for request
duration Adds duration limit for request
span Executes accept if in the specified time range, ignore otherwise.
rate Executes ignore if reaches the value or on multiples of, accept otherwise.

Actions

Action Explanation
accept Execute if span and rate conditions doesn't match in the specified scenario
ignore Execute if span and rate conditions does match in the specified scenario
direct Specifies which scenario should be handled by next request
result Specifies Result Type that will be return eventually
status Specifies Status Code for given Result Type

Results

Result Explanation
type Result Type of the content
content Definitions the relevant result's content, according to Result Type

Result Type

Result Type Explanation
static Returns json content
file Returns content.type after reading the file in content.path
redirect Sends 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   help for 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

Owner
Trendyol Open Source
Trendyol Open Source
Full-featured test framework for Go! Assertions, mocking, input testing, output capturing, and much more! 🍕

testza ?? Testza is like pizza for Go - you could life without it, but why should you? Get The Module | Documentation | Contributing | Code of Conduct

Marvin Wendt 389 Jun 18, 2022
Robust framework for running complex workload scenarios in isolation, using Go; for integration, e2e tests, benchmarks and more! 💪

e2e Go Module providing robust framework for running complex workload scenarios in isolation, using Go and Docker. For integration, e2e tests, benchma

null 100 Jun 5, 2022
HTTP traffic mocking and testing made easy in Go ༼ʘ̚ل͜ʘ̚༽

gock Versatile HTTP mocking made easy in Go that works with any net/http based stdlib implementation. Heavily inspired by nock. There is also its Pyth

Tom 1.6k Jun 24, 2022
HTTP mocking for Golang

httpmock Easy mocking of http responses from external resources. Install Currently supports Go 1.7 - 1.15. v1 branch has to be used instead of master.

Jared Morse 1.4k Jun 23, 2022
Lightweight HTTP mocking in Go (aka golang)

httpmock This library builds on Go's built-in httptest library, adding a more mockable interface that can be used easily with other mocking tools like

null 77 Jun 27, 2022
A simple and expressive HTTP server mocking library for end-to-end tests in Go.

mockhttp A simple and expressive HTTP server mocking library for end-to-end tests in Go. Installation go get -d github.com/americanas-go/mockhttp Exa

Americanas Go 6 Dec 19, 2021
Go Interface Mocking Tool

Charlatan Percolate's Go Interface Mocking Tool. Please read our introductory blog post. Installation go get github.com/percolate/charlatan Usage c

Percolate 195 May 23, 2022
GoMock is a mocking framework for the Go programming language.

gomock GoMock is a mocking framework for the Go programming language. It integrates well with Go's built-in testing package, but can be used in other

Go 7.5k Jun 19, 2022
A clipboard-based mocking framework for Go that gets out of your way.

A clipboard-based mocking framework for Go that gets out of your way. This tool has been built with inspiration lovingly taken from Moq, and fuelled b

Roger Guldbrandsen 40 Jun 13, 2022
Interface mocking tool for go generate

Interface mocking tool for go generate. What is Moq? Moq is a tool that generates a struct from any interface. The struct can be used in test code as

Mat Ryer 1.3k Jun 20, 2022
This repository includes consumer driven contract test for provider, unit test and counter api.

This repository includes consumer driven contract test for provider, unit test and counter api.

Ahmet Zümberoğlu 0 Feb 1, 2022
Test your code without writing mocks with ephemeral Docker containers 📦 Setup popular services with just a couple lines of code ⏱️ No bash, no yaml, only code 💻

Gnomock – tests without mocks ??️ Spin up entire dependency stack ?? Setup initial dependency state – easily! ?? Test against actual, close to product

Yury Fedorov 845 Jun 26, 2022
go-test-trace is like go test but it also generates distributed traces.

go-test-trace go-test-trace is like go test but it also generates distributed traces. Generated traces are exported in OTLP to a OpenTelemetry collect

JBD 373 Jun 24, 2022
Flugel Test Documentation for steps to run and test the automatio

Flugel Test Documentation Documentation for steps to run and test the automation #Test-01 1 - Local Test Using Terratest (End To End) 1- By runing " t

Suc0_Unix 0 Dec 30, 2021
Test-assignment - Test assignment with golang

test-assignment We have a two steam of data and we need to save it in the map: I

null 0 Jan 19, 2022
Tesuto - a little library for testing against HTTP services

tesuto import "github.com/guregu/tesuto" tesuto is a little library for testing

Greg 2 Jan 18, 2022
http integration test framework

go-hit hit is an http integration test framework written in golang. It is designed to be flexible as possible, but to keep a simple to use interface f

Tobias Salzmann 108 Jun 19, 2022
Simple HTTP integration test framework for Golang

go-itest Hassle-free REST API testing for Go. Installation go get github.com/jefflinse/go-itest Usage Create tests for your API endpoints and run the

Jeff Linse 12 Jan 8, 2022
Http test server written in Golang.

Dummy Server Http test server written in Golang. Can get any request method and log headers, body, path and remote address. Useful if you need to know

Yury Krylov 0 Oct 31, 2021