Full-spectrum integration testing system.
grzkv opened this issue · 1 comments
Motivation
There are multiple bugs that are not detected by our current CI and unit tests. The stability bugs are especially frequent of those. Unit tests are not well-suited to test the parts of code that call into the OS and especially the ones using networking. An integration testing system is a much better candidate here.
Requirements
- Tests the following:
- Stability and liveness of
carbonapi
while processing a set of requests. - Timeout test for a set of typical requests.
- (in the future) Correctness test for a set of typical
render
andfind
requests. - (in the future) Test a metrics scrape.
- Stability and liveness of
- Can run automatically for each PR.
- Can run in any environment.
- Uses mock backends, which:
- Are tens in number.
- Are split into clusters.
- Have replication.
- Uses neutral data. E.g. randomly generated data.
Design
System consists of three parts:
- HTTP requests player, which will send a set of requests to
carbonapi
that are defined in advance. carbonapi
itself.- Set of mock backends, which simulate the real-life backends.
In the first version, it makes sense to run them on a single box (it can also be a container) or inside 3 separate containers via docker-compose. Each backend will occupy a port on a single machine.
HTTP player details
There are multiple available. We don't have to write our own. We need to try and choose one.
Mock backends
We will have to implement this part. Mock backends should support the main procol we use for communication with a real backend. They will play back preset responses for each request.
Workflow
The test will run something like this:
- Bring up all the systems.
- Send a set of requests to
carbonapi
. - Check if the responses were received.
- (in the future) Check correctness of the responses.
- (in the future) Try scraping metrics from
carbonapi
and check if they satisfy basic heuristics. - Check liveness of
carbonapi
.
It makes sense to me.
In my opinion, we can start with the HTTP player part and correctness/scrape tests using the normal go-carbon backend, as we have in hurl tests, but without hurl. :)
Then we can spend time on the mock backend and create tests for stability and timeouts.