mockingjay-server

所属分类:快速开发平台
开发工具:GO
文件大小:224KB
下载次数:0
上传日期:2022-05-26 17:45:27
上 传 者sh-1993
说明:  伪造服务器、消费者驱动的契约,并帮助从一个配置文件中测试零系统的性能...
(Fake server, Consumer Driven Contracts and help with testing performance from one configuration file with zero system dependencies and no coding whatsoever)

文件列表:
.travis.yml (924, 2021-01-15)
Dockerfile (435, 2021-01-15)
LICENSE.txt (1081, 2021-01-15)
acceptance_test.go (3386, 2021-01-15)
application.go (4285, 2021-01-15)
application_test.go (4500, 2021-01-15)
build.sh (258, 2021-01-15)
config.go (1438, 2021-01-15)
config_loader_test.go (405, 2021-01-15)
config_loaders.go (1528, 2021-01-15)
examples (0, 2021-01-15)
examples\check.sh (83, 2021-01-15)
examples\example.yaml (4607, 2021-01-15)
examples\functional-test.yaml (757, 2021-01-15)
examples\incompatible.yaml (522, 2021-01-15)
examples\invalid.yaml (11, 2021-01-15)
examples\issue16 (0, 2021-01-15)
examples\issue16\mock.yaml (203, 2021-01-15)
examples\issue16\real.yaml (165, 2021-01-15)
examples\issue40 (0, 2021-01-15)
examples\issue40\1.yaml (118, 2021-01-15)
examples\issue40\2.yaml (103, 2021-01-15)
examples\issue42.yaml (220, 2021-01-15)
examples\ml.yaml (372, 2021-01-15)
examples\monkey-business.yaml (341, 2021-01-15)
examples\regex.yaml (224, 2021-01-15)
examples\run.sh (63, 2021-01-15)
examples\smoke-test.yaml (757, 2021-01-15)
get-example-coverage.sh (85, 2021-01-15)
main.go (1536, 2021-01-15)
mockingjay (0, 2021-01-15)
mockingjay\compatibility.go (4605, 2021-01-15)
mockingjay\compatibility_benchmark_test.go (1215, 2021-01-15)
mockingjay\compatibility_test.go (6436, 2021-01-15)
mockingjay\example_test.go (1189, 2021-01-15)
... ...

# mockingjay server [![Build Status](https://travis-ci.org/quii/mockingjay-server.svg?branch=master)](https://travis-ci.org/quii/mockingjay-server)[![Coverage Status](https://coveralls.io/repos/quii/mockingjay-server/badge.svg?branch=master)](https://coveralls.io/r/quii/mockingjay-server?branch=master)[![GoDoc](https://godoc.org/github.com/quii/mockingjay-server?status.svg)](https://godoc.org/github.com/quii/mockingjay-server) ![mj example](http://i.imgur.com/ZtI1Q39.gif) Mockingjay lets you define the contract between a consumer and producer and with just a configuration file you get: - A fast to launch fake server for your integration tests - Configurable to simulate the eratic nature of calling other services - [Consumer driven contracts (CDCs)](http://martinfowler.com/articles/consumerDrivenContracts.html) to run against your real downstream services. **Mockingjay makes it really easy to check your HTTP integration points**. It's fast, requires no coding and is better than other solutions because it will ensure your mock servers and real integration points are consistent so that you never have a green build but failing software. - [Installation](https://github.com/quii/mockingjay-server/wiki/Installing) - [Download a binary](https://github.com/quii/mockingjay-server/releases/latest), [use a Docker image](https://hub.docker.com/r/quii/mockingjay-server/) or `go get` - [Rationale](https://github.com/quii/mockingjay-server/wiki/Rationale) - [See how mockingjay can easily fit into your workflow to make integration testing really easy and robust](https://github.com/quii/mockingjay-server/wiki/Suggested-workflow) ## Running a fake server ````yaml --- - name: My very important integration point request: uri: /hello method: POST body: "Chris" # * matches any body response: code: 200 body: '{"message": "hello, Chris"}' # * matches any body headers: content-type: application/json # define as many as you need... ```` ````bash $ mockingjay-server -config=example.yaml -port=1234 & 2015/04/13 14:27:54 Serving 3 endpoints defined from example.yaml on port 1234 $ curl http://localhost:1234/hello {"message": "hello, world"} ```` ## Check configuration is compatible with a real server ````bash $ mockingjay-server -config=example.yaml -realURL=http://some-real-api.com 2015/04/13 21:06:06 Test endpoint (GET /hello) is incompatible with http://some-real-api - Couldn't reach real server 2015/04/13 21:06:06 Test endpoint 2 (DELETE /world) is incompatible with http://some-real-api - Couldn't reach real server 2015/04/13 21:06:06 Failing endpoint (POST /card) is incompatible with http://some-real-api - Couldn't reach real server 2015/04/13 21:06:06 At least one endpoint was incompatible with the real URL supplied ```` This ensures your integration test is working against a *reliable* fake. ### Inspect what requests mockingjay has received http://{mockingjayhost}:{port}/requests Calling this will return you a JSON list of requests ## Make your fake server flaky Mockingjay has an annoying friend, a monkey. Given a monkey configuration you can make your fake service misbehave. This can be useful for performance tests where you want to simulate a more realistic scenario (i.e all integration points are painful). ````yaml --- # Writes a different body 50% of the time - body: "This is wrong :( " frequency: 0.5 # Delays initial writing of response by a second 20% of the time - delay: 1000 frequency: 0.2 # Returns a 404 30% of the time - status: 404 frequency: 0.3 # Write 10,000,000 garbage bytes 9% of the time - garbage: 10000000 frequency: 0.09 ```` ````bash $ mockingjay-server -config=examples/example.yaml -monkeyConfig=examples/monkey-business.yaml 2015/04/17 14:19:53 Serving 3 endpoints defined from examples/example.yaml on port 9090 2015/04/17 14:19:53 Monkey config loaded 2015/04/17 14:19:53 50% of the time | Body: This is wrong :( 2015/04/17 14:19:53 20% of the time | Delay: 1s 2015/04/17 14:19:53 30% of the time | Status: 404 2015/04/17 14:19:53 9% of the time | Garbage bytes: 10000000 ```` ## Building ### Requirements - Go 1.3+ installed ($GOPATH set, et al) - golint https://github.com/golang/lint ### Build application ````bash $ go get github.com/quii/mockingjay-server $ cd $GOPATH/src/github.com/quii/mockingjay-server $ ./build.sh ```` MIT license

近期下载者

相关文件


收藏者