-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
Cleanup some e2e test configurations #14389
Conversation
25fdc56
to
d4c9fac
Compare
Codecov Report
@@ Coverage Diff @@
## main #14389 +/- ##
==========================================
+ Coverage 70.73% 70.78% +0.05%
==========================================
Files 455 455
Lines 37161 37161
==========================================
+ Hits 26285 26306 +21
+ Misses 9362 9338 -24
- Partials 1514 1517 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
3b34e80
to
fe3dc2d
Compare
cc @serathius @spzala @ptabor @clarkfw |
tests/framework/e2e/cluster.go
Outdated
QuotaBackendBytes int64 | ||
NoStrictReconfig bool | ||
EnableV2 bool | ||
DisableInitialCorruptCheck bool |
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 don't think this direction is much better. This is bad way to handle defaults, negating the configuration fields again makes it harder to track and understand.
Instead I would prefer that we separate struct definition from defaults. This way we can make the configuration struct more similar to "production" one and just have tests having different defaults.
Example of what I mean:
type EtcdProcessClusterConfig struct {
...
InitialCorruptionCheck bool
...
}
func DefaultEtcdProcessClusterConfig() *EtcdProcessClusterConfig {
return &EtcdProcessClusterConfig{
InitialCorruptionCheck: true,
}
}
func TestCorruption(t *testing.T) {
config := DefaultEtcdProcessClusterConfig()
config.InitialCorruptionCheck = false
...
}
Later we might decide to shorten shorten code by adding options for DefaultEtcdProcessClusterConfig, but this is separate issue.
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 don't think this direction is much better. This is bad way to handle defaults, negating the configuration fields again makes it harder to track and understand.
Instead I would prefer that we separate struct definition from defaults. This way we can make the configuration struct more similar to "production" one and just have tests having different defaults.
Thanks. Actually it's a tradeoff. The good side is that we can leverage golang build-in feature of zero value (e.g. false
for bool), so that the implementation can be simplified because we need to do nothing if we just want to use the default value; while the bad side it's counterintuitive (not disable == enable), and it isn't consistent with the product code just as you pointed out.
Let me follow your suggestion in this PR. I will rollback the change to InitialCorruptCheck
, and we can address it in a separate PR.
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.
Done.
Notes: 1. compactPhysical in ctlCtx and withQuota aren't used at all, they are dead code. 2. quotaBackendBytes in ctlCtx isn't used either. Instead, users (test cases) set the QuotaBackendBytes directly. Signed-off-by: Benjamin Wang <wachao@vmware.com>
fe3dc2d
to
17b83ea
Compare
See #14360 (comment)
Notes:
compactPhysical
inctlCtx
andwithQuota
aren't used at all, they are dead code.quotaBackendBytes
inctlCtx
isn't used either. Instead, users (test cases) set the QuotaBackendBytes directly.initialCorruptCheck
) by default, then a best practice is to define the field as "DisableXX
", such asDisableInitialCorruptCheck bool
. Its value will befalse
by default if not set.Signed-off-by: Benjamin Wang wachao@vmware.com