Skip to content
This repository was archived by the owner on Aug 23, 2023. It is now read-only.

Refactor chaos dir to stacktest dir #830

Merged
merged 15 commits into from
Apr 11, 2018
Merged

Refactor chaos dir to stacktest dir #830

merged 15 commits into from
Apr 11, 2018

Conversation

Dieterbe
Copy link
Contributor

@Dieterbe Dieterbe commented Jan 24, 2018

  • a bunch of refactoring / code-reorganisation of chaos dir which is now "stacktest" because it does both chaos testing as well as regular (see below), and adds a few more helper functions
  • replace the python based end2end testing with the stacktest/tests/end2end_carbon/end2end_carbon_test.go file

@Dieterbe Dieterbe requested a review from replay January 24, 2018 12:06
@Dieterbe
Copy link
Contributor Author

@replay what do you think of this?

@Dieterbe
Copy link
Contributor Author

Dieterbe commented Jan 24, 2018

seems like in practice, the old code is faster on circleCI, even though on my computer new is about twice as fast 🎱
https://circleci.com/gh/grafana/metrictank/3594 (master)
https://circleci.com/gh/grafana/metrictank/3589 (this)

to be clear, the speedup is supposed to come from the new approach being more eager (e.g. it'll retry the request until it gets a valid one, whereas the old approach just waits 30 seconds before checking)

edit: seems like the slowdown is coming from the teardown of the stack at the end

@replay
Copy link
Contributor

replay commented Jan 25, 2018

Seems ok. But what is actually the point of replacing the end2end test? isn't that just doing the same?

@Dieterbe
Copy link
Contributor Author

there isn't a significant amount of point. that's why this also isn't high prio or anything, but I do think it's better that towards the future that all our different verification tooling converges on a set of standardized helper utilities for validating responses.
the speedup would also be nice, except it doesn't work on circleci yet

Dieterbe added 14 commits April 11, 2018 09:43
will be useful for carbon tests
otherwise got errors like 0: already closed
1) it's about twice as fast (on my system at least)
   ./scripts/qa/end2end.sh           1.17s user 0.18s system 2% cpu 1:05.40 total
   go test -v ./tests/simple_carbon  1.35s user 0.20s system 5% cpu 30.795 total

2) reuse of shared helper libraries with chaos stack.
   these helper libraries are good for all kinds of testing, not just
   chaos-induced

3) we're better at Go than at python
with previous approach, while docker-compose up was running,
bash would just wait on it, and be unable to invoke its trap handler.
apparently, when running the script interactively, ctrl-C would reach
docker-compose up directly, then invoke the trap handler,
but when running the script as subprocess, the signal wouldn't reach
anyone.

see
https://unix.stackexchange.com/questions/146756/forward-sigterm-to-child-in-bash
so we don't get connection/write errors when cleaning up
the tests and shutting down the docker stack.
* context for Command -> when you call cancelFunc() it uses sigkill
  we need the process to be able to clean up elegantly,
  so we need a more gentle signal
  this was causing us not to be able to shut down the tests properly
* no need for context in tracker either, because we can simply complete
  reads before waiting for command
so you can see timing info everywhere needed
@Dieterbe
Copy link
Contributor Author

update: makes sense to merge, especially now that the fakemetrics tool has seen a bunch of changes; with the old tooling, would need to somehow pin the fakemetrics binary to the exact right version, but with this code, it's trivial to assert that the tooling is in sync.
unfortunate that for some reason tearing down the docker-compose stack takes so long on circle, maybe we can solve that later.

@Dieterbe Dieterbe merged commit 5b7785e into master Apr 11, 2018
@Dieterbe Dieterbe deleted the refactor-chaos branch April 20, 2018 08:36
Dieterbe added a commit that referenced this pull request Jun 12, 2018
Dieterbe added a commit that referenced this pull request Jun 13, 2018
Dieterbe added a commit that referenced this pull request Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants