Merge pull request #14825 from clarkfw/EtcdProcessClusterConfig-antipattern-name

tests: fix anti-pattern name in `NewEtcdProcessCluster`
This commit is contained in:
Marek Siarkowicz 2022-11-23 15:11:36 +01:00 committed by GitHub
commit 51c0b4dff3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 20 deletions

View File

@ -222,7 +222,7 @@ func testCtlWithOffline(t *testing.T, testFunc func(ctlCtx), testOfflineFunc fun
if !ret.quorum { if !ret.quorum {
ret.cfg = *e2e.ConfigStandalone(ret.cfg) ret.cfg = *e2e.ConfigStandalone(ret.cfg)
} }
ret.cfg.DisableStrictReconfigCheck = ret.disableStrictReconfigCheck ret.cfg.StrictReconfigCheck = !ret.disableStrictReconfigCheck
if ret.initialCorruptCheck { if ret.initialCorruptCheck {
ret.cfg.InitialCorruptCheck = ret.initialCorruptCheck ret.cfg.InitialCorruptCheck = ret.initialCorruptCheck
} }

View File

@ -103,7 +103,7 @@ func NewConfigClientTLSCertAuthWithNoCN() *EtcdProcessClusterConfig {
WithClusterSize(1), WithClusterSize(1),
WithClientConnType(ClientTLS), WithClientConnType(ClientTLS),
WithClientCertAuthority(true), WithClientCertAuthority(true),
WithNoCN(true), WithCN(false),
) )
} }
@ -152,18 +152,18 @@ type EtcdProcessClusterConfig struct {
Client ClientConfig Client ClientConfig
IsPeerTLS bool IsPeerTLS bool
IsPeerAutoTLS bool IsPeerAutoTLS bool
NoCN bool CN bool
CipherSuites []string CipherSuites []string
ForceNewCluster bool ForceNewCluster bool
InitialToken string InitialToken string
QuotaBackendBytes int64 QuotaBackendBytes int64
DisableStrictReconfigCheck bool StrictReconfigCheck bool
EnableV2 bool EnableV2 bool
InitialCorruptCheck bool InitialCorruptCheck bool
AuthTokenOpts string AuthTokenOpts string
V2deprecation string V2deprecation string
RollingStart bool RollingStart bool
@ -186,8 +186,10 @@ type EtcdProcessClusterConfig struct {
func DefaultConfig() *EtcdProcessClusterConfig { func DefaultConfig() *EtcdProcessClusterConfig {
return &EtcdProcessClusterConfig{ return &EtcdProcessClusterConfig{
ClusterSize: 3, ClusterSize: 3,
InitialToken: "new", InitialToken: "new",
StrictReconfigCheck: true,
CN: true,
} }
} }
@ -257,16 +259,16 @@ func WithClientRevokeCerts(isClientCRL bool) EPClusterOption {
return func(c *EtcdProcessClusterConfig) { c.Client.RevokeCerts = isClientCRL } return func(c *EtcdProcessClusterConfig) { c.Client.RevokeCerts = isClientCRL }
} }
func WithNoCN(noCN bool) EPClusterOption { func WithCN(cn bool) EPClusterOption {
return func(c *EtcdProcessClusterConfig) { c.NoCN = noCN } return func(c *EtcdProcessClusterConfig) { c.CN = cn }
} }
func WithQuotaBackendBytes(bytes int64) EPClusterOption { func WithQuotaBackendBytes(bytes int64) EPClusterOption {
return func(c *EtcdProcessClusterConfig) { c.QuotaBackendBytes = bytes } return func(c *EtcdProcessClusterConfig) { c.QuotaBackendBytes = bytes }
} }
func WithDisableStrictReconfigCheck(disable bool) EPClusterOption { func WithStrictReconfigCheck(strict bool) EPClusterOption {
return func(c *EtcdProcessClusterConfig) { c.DisableStrictReconfigCheck = disable } return func(c *EtcdProcessClusterConfig) { c.StrictReconfigCheck = strict }
} }
func WithEnableV2(enable bool) EPClusterOption { func WithEnableV2(enable bool) EPClusterOption {
@ -488,7 +490,7 @@ func (cfg *EtcdProcessClusterConfig) EtcdServerProcessConfig(tb testing.TB, i in
"--quota-backend-bytes", fmt.Sprintf("%d", cfg.QuotaBackendBytes), "--quota-backend-bytes", fmt.Sprintf("%d", cfg.QuotaBackendBytes),
) )
} }
if cfg.DisableStrictReconfigCheck { if !cfg.StrictReconfigCheck {
args = append(args, "--strict-reconfig-check=false") args = append(args, "--strict-reconfig-check=false")
} }
if cfg.EnableV2 { if cfg.EnableV2 {

View File

@ -64,7 +64,7 @@ func CURLPrefixArgs(cfg *EtcdProcessClusterConfig, member EtcdProcess, method st
cmdArgs = append(cmdArgs, "--cacert", CaPath, "--cert", CertPath, "--key", PrivateKeyPath) cmdArgs = append(cmdArgs, "--cacert", CaPath, "--cert", CertPath, "--key", PrivateKeyPath)
acurl = ToTLS(member.Config().Acurl) acurl = ToTLS(member.Config().Acurl)
} else if cfg.Client.ConnectionType == ClientTLS { } else if cfg.Client.ConnectionType == ClientTLS {
if !cfg.NoCN { if cfg.CN {
cmdArgs = append(cmdArgs, "--cacert", CaPath, "--cert", CertPath, "--key", PrivateKeyPath) cmdArgs = append(cmdArgs, "--cacert", CaPath, "--cert", CertPath, "--key", PrivateKeyPath)
} else { } else {
cmdArgs = append(cmdArgs, "--cacert", CaPath, "--cert", CertPath3, "--key", PrivateKeyPath3) cmdArgs = append(cmdArgs, "--cacert", CaPath, "--cert", CertPath3, "--key", PrivateKeyPath3)

View File

@ -48,7 +48,7 @@ func (e e2eRunner) NewCluster(ctx context.Context, t testing.TB, opts ...config.
e2eConfig := NewConfig( e2eConfig := NewConfig(
WithClusterSize(cfg.ClusterSize), WithClusterSize(cfg.ClusterSize),
WithQuotaBackendBytes(cfg.QuotaBackendBytes), WithQuotaBackendBytes(cfg.QuotaBackendBytes),
WithDisableStrictReconfigCheck(!cfg.StrictReconfigCheck), WithStrictReconfigCheck(cfg.StrictReconfigCheck),
WithAuthTokenOpts(cfg.AuthToken), WithAuthTokenOpts(cfg.AuthToken),
WithSnapshotCount(cfg.SnapshotCount), WithSnapshotCount(cfg.SnapshotCount),
) )