A proxy to A/B test web services.
A common pattern to test web services is to deploy a copy of the server with the new code under a different host/ELB while the baseline/control instance is left untouched. During this time, various manual and automated tests are run to ensure the new instance of the service meets QA acceptance.
While some changes are expected (addition of new fields, removal of deprecated ones), most day to day bug fixes and under the hood improvements are not expected to change the final output of the service. diff-web
is a proxy that forwards your requests to 2 endpoints before diff-ing the response body.
NOTE: We require the diff
command to be available in the $PATH
.
-
Get stack
-
Clone this repository
git clone git@github.com:naushadh/diff-web.git
-
From repository folder, build
stack build --pedantic --ghc-options '-O2'
-
Install
stack install diff-web-exe
The following settings can be set via ENV
DIFF_PORT=8080
$ diff-web-exe
... should print port listened on
-
Send all desired requests to the app
-
Ensure the following headers are set for forward endpoints
DIFF_HOST_A: app.com DIFF_HOST_B: dev.app.com
-
When responses are the same, you get the response from host B
-
When responses differ, you get a 400 error with the diff in the body.
In no particular order
- Add a simple HTML UI for better user-friendliness (esp: very large diffs).
- Add tests
- Add Dockerfile for build+deployment convenience
- Find a pure haskell
diff
alternative and/or ship it with the app to ensure we're fully self contained.