Skip to content
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

Merged
merged 1 commit into from
Mar 28, 2023

Conversation

serathius
Copy link
Member

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?

@serathius serathius marked this pull request as draft November 23, 2022 15:28
@serathius serathius force-pushed the linearizability-docs branch 2 times, most recently from a115242 to 1478354 Compare November 24, 2022 16:12
@serathius
Copy link
Member Author

cc @lavacat @geetasg

@geetasg
Copy link

geetasg commented Feb 9, 2023

It would be nice to have a contributor section that guides on how to extend the model.

@serathius serathius changed the title tests: Document linearizability tests tests: Document robustness tests Mar 18, 2023
@serathius serathius force-pushed the linearizability-docs branch from 1478354 to 044051c Compare March 18, 2023 12:07
@serathius serathius marked this pull request as ready for review March 18, 2023 12:08
@serathius
Copy link
Member Author

Finally got to writing down the docs.
cc @ahrtr @ptabor @logicalhan @chaochn47 @jmhbnz

Copy link

@logicalhan logicalhan left a 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
Comment on lines 142 to 155
.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
Copy link
Member

@ahrtr ahrtr Mar 21, 2023

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.

Copy link
Member Author

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

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Contributor

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:

  1. Decide how we want to run robustness tests against historical versions long-term:
  2. Address in a similar way the historical cases the requires very specific etcd revision for repro.

  1. 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
  1. 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.

Copy link
Member Author

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.

@serathius serathius force-pushed the linearizability-docs branch from 044051c to 106070f Compare March 28, 2023 13:04
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
@serathius serathius force-pushed the linearizability-docs branch from 106070f to d03ac88 Compare March 28, 2023 13:08
@serathius
Copy link
Member Author

PTAL @ahrtr @ptabor

* `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.
Copy link
Contributor

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 ?

Copy link
Member Author

@serathius serathius Mar 28, 2023

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[@]}" "$@"
Copy link
Member Author

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} "$@" )
Copy link
Member Author

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.

@serathius serathius merged commit 5223d09 into etcd-io:main Mar 28, 2023
@serathius serathius deleted the linearizability-docs branch June 15, 2023 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants