-
Notifications
You must be signed in to change notification settings - Fork 9.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tests: Document robustness tests #14838
Conversation
a115242
to
1478354
Compare
It would be nice to have a contributor section that guides on how to extend the model. |
1478354
to
044051c
Compare
Finally got to writing down the docs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
Makefile
Outdated
.PHONY: reproduce-issue14370 | ||
reproduce-issue14370: bin/etcd-v3.5.4-failpoints | ||
cp bin/etcd-v3.5.4-failpoints ./bin/etcd | ||
GO_TEST_FLAGS='-v --run=TestRobustness/Issue14370 --count 100 --failfast' make test-robustness | ||
|
||
.PHONY: reproduce-issue13766 | ||
reproduce-issue13766: bin/etcd-v3.5.2-failpoints | ||
cp bin/etcd-v3.5.2-failpoints ./bin/etcd | ||
GO_TEST_FLAGS='-v --run=TestRobustness/Issue13766 --count 100 --failfast' make test-robustness | ||
|
||
.PHONY: reproduce-issue14685 | ||
reproduce-issue14685: bin/etcd-v3.5.5-failpoints | ||
cp bin/etcd-v3.5.5-failpoints ./bin/etcd | ||
GO_TEST_FLAGS='-v --run=TestRobustness/Issue14685 --count 100 --failfast' make test-robustness |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recall I raised a comment somewhere that the top level Makefile
isn't a good place to just demonstrate the ability of the robustness test, and @ptabor suggested to move them into a script or doc inside a sub-directory.
I still have the same comment. Let's keep the top level Makefile as simple & clean as possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't agree with this. Robustness test targets touch files whole repo making it impossible/bothersome to put it in subdirectory. For example moving proposed targets to tests/robustness/Makefile
would result in all paths needing to be prefixed cd ../.. &&
.
Let's keep the top level Makefile as simple & clean as possible.
Don't agree, each Makefile target should be simple and clean, however it doesn't mean that root Makefile should have limited list of targets. I would argue that makefile scales pretty well with number of targets, assuming that we maintain a proper structure. For example https://github.com/kubernetes-sigs/metrics-server/blob/master/Makefile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me the problem is that we want to avoid adding more targets to root Makefile for it to remain simple & clean
, however I expect that it will cause reverse effect. Make code more complicated by introducing hard to follow dependencies. Proposed targets cannot be simply moved to subdir as they depend on targets (like GOFAIL_VERSION
, gofail-enable
, gofail-disable
, test-robustness
) and directories (like ./bin
) from root directory.
Simple and clean solution here is just put those targets in root directory. Distributing makefile targets between subdirectories is the more complicated option. Makefile was just not designed for hierarchy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't propose to add another Makefile in a sub-directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I misread.
@ptabor suggested to move them into a script or doc inside a sub-directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still would prefer to split the files. Even for sake of avoiding long content in the main directory.
My approach would be following:
- Decide how we want to run robustness tests against historical versions long-term:
- Address in a similar way the historical cases the requires very specific etcd revision for repro.
- I think that the build code should be as much as possible versioned together with the System-Under-Test. In this case for 3.4.x, 3.5.x, 3.6.0+ I would cherry pick to the main Makefile a rule that allows to build:
make build-with-failpoints FAILPOINTS=${GO_FAIL_VERSION}
that as an outcome would produce ./bin/etcd-failpoints
(and potentially the other binaries)
This would allow us to have in the main file a generic rule:
./tmp/etcd-${}/bin/etcd-failpoints:
(clones the repo and calls the nested build)
robustness-test-{...}: ./tmp/etcd-{...}/bin/etcd-failpoints
ETCD_BIN=./tmp/etcd-{...}/bin/etcd-failpoints make test-robustness
- For the specific repro, I would consider using the Makefile's include (https://www.gnu.org/software/make/manual/html_node/Include.html)
So having the code in ./tests/robustness/makefile.mk
and including it from the main MakeFile.
I think that such inclusion does not causes the cd ../..
problems still allowing to encapsulate the robustness related code with the robustness tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved robustness test targets to ./tests/robustness/makefile.mk. However I would wait with unifying build with failpoints targets for older branches. I think it's an overkill for now and we can always improve it later.
044051c
to
106070f
Compare
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
106070f
to
d03ac88
Compare
* `GO_TEST_FLAGS` - to pass additional arguments to `go test`. | ||
It is recommended to run tests multiple times with failfast enabled. this can be done by setting `GO_TEST_FLAGS='--count=100 --failfast'`. | ||
* `EXPECT_DEBUG=true` - to get logs from the cluster. | ||
* `RESULTS_DIR` - to change location where results report will be saved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the default for RESULTS_DIR ? within the test's tmp directory that is cleaned after success ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, robustness tests specifically create its own directory in tmp that is not created via t.TmpDir()
. It even copies db files there to ensure they are preserved.
@@ -126,7 +126,7 @@ function e2e_pass { | |||
|
|||
function robustness_pass { | |||
# e2e tests are running pre-build binary. Settings like --race,-cover,-cpu does not have any impact. | |||
run_for_module "tests" go_test "./robustness/..." "keep_going" : -timeout="${TIMEOUT:-30m}" "${RUN_ARG[@]}" "$@" | |||
run_for_module "tests" go_test "./robustness" "keep_going" : -timeout="${TIMEOUT:-30m}" "${RUN_ARG[@]}" "$@" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Subdirs include normal unit tests that are not aware of --bin-dir
flag. Unit tests are already run via make test-unit
@@ -315,7 +315,7 @@ function go_test { | |||
additional_flags=$(${flags_for_package_func} ${pkg}) | |||
|
|||
# shellcheck disable=SC2206 | |||
local cmd=( go test ${goTestFlags} ${additional_flags} "$@" ${pkg} ) | |||
local cmd=( go test ${goTestFlags} ${additional_flags} ${pkg} "$@" ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flags defined by tests like --bin-dir
need to be passed after package.
Please read https://github.com/etcd-io/etcd/blob/main/CONTRIBUTING.md#contribution-flow.
cc @ahrtr @ptabor @spzala
Do you have any suggestion on topics to cover in the README?