-
Notifications
You must be signed in to change notification settings - Fork 169
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
Revisit tests #146
Comments
Hi @pav-kv, For the code you mentioned in "Eliminate Boilerplate", I am interested in improving it and have the time to do so. If I understand correctly, the following code
Should it be changed into something like this?
If you were expecting that, I would like to work on this as a starting point to contribute to etcd. |
@MrDXY Yes, the idea is right. Feel free to send a PR. In most cases we don't need the formatted text part. It's enough to do this: assert.Equal(t, tt.wstate, sm.state) There are some cases in which we need to add some information to the error, to identify the sub-test that failed. The example you quoted would then be like: assert.Equal(t, tt.wstate, sm.state, "#%d.%d", i, j) Also, |
Noted. Thanks! I'll give it a try. |
Hi, @pav-kv I found multiple files that use t.Error/Fatal. While not all the files require a refactor, I am listing them for awareness. I plan to begin with
|
Part of: etcd-io#146 Signed-off-by: dxinyuan <[email protected]>
Part of: etcd-io#146 Signed-off-by: dxinyuan <[email protected]>
Part of: etcd-io#146 Signed-off-by: Xinyuan Du <[email protected]>
Part of: etcd-io#146 Signed-off-by: Xinyuan Du <[email protected]>
Part of: etcd-io#146 Signed-off-by: Xinyuan Du <[email protected]>
Part of: etcd-io#146 Signed-off-by: Xinyuan Du <[email protected]>
Part of: etcd-io#146 Signed-off-by: Xinyuan Du <[email protected]>
Part of: etcd-io#146 Signed-off-by: Xinyuan Du <[email protected]> Signed-off-by: dxinyuan <[email protected]>
Part of: etcd-io#146 Signed-off-by: Xinyuan Du <[email protected]> Signed-off-by: dxinyuan <[email protected]>
Part of: etcd-io#146 Signed-off-by: dxinyuan <[email protected]>
Part of: etcd-io#146 Signed-off-by: Xinyuan Du <[email protected]> Signed-off-by: dxinyuan <[email protected]>
Part of: etcd-io#146 Signed-off-by: Xinyuan Du <[email protected]>
@MrDXY Please don't reference this issue from individual commits. This spams the history of this issue (see above: every time the commit is updated, it posts a new link to this issue). Instead, please reference the issue only from the PR description. |
Part of: etcd-io#146 Signed-off-by: Xinyuan Du <[email protected]>
Hey @pav-kv , it's been a while since I was on this. IMHO, I think the |
@MrDXY SGTM. Thanks a lot for this clean-up! |
This is an umbrella issue for all kinds of unit-test improvements. Unit-tests in this repository are significantly outdated, and need a revamp. For example:
Examples of things to fix/improve:
RawNode / raft
structs arbitrarily, which breaks internal invariants and makes tests prone to false failures on any change. This necessitates PR authors to spend time debugging and fixing incorrect tests.require/assert
packages. Revisit tests #146 (comment)r.Term >= r.raftLog.lastTerm()
. Tests that manipulateRawNode
structs directly may accidentally break invariants, and end up testing arbitrary behaviour rather than real one.The text was updated successfully, but these errors were encountered: