From b298c85a34bffa3ec516fd83ec21f708790d8004 Mon Sep 17 00:00:00 2001 From: Clark Date: Wed, 23 Nov 2022 00:32:10 +0800 Subject: [PATCH] tests: fix anti-pattern name in `NewEtcdProcessCluster` Signed-off-by: Clark --- tests/e2e/ctl_v3_test.go | 2 +- tests/framework/e2e/cluster.go | 36 ++++++++++++++++++---------------- tests/framework/e2e/curl.go | 2 +- tests/framework/e2e/e2e.go | 2 +- 4 files changed, 22 insertions(+), 20 deletions(-) diff --git a/tests/e2e/ctl_v3_test.go b/tests/e2e/ctl_v3_test.go index 5254fbf5c5d..d08306396f6 100644 --- a/tests/e2e/ctl_v3_test.go +++ b/tests/e2e/ctl_v3_test.go @@ -222,7 +222,7 @@ func testCtlWithOffline(t *testing.T, testFunc func(ctlCtx), testOfflineFunc fun if !ret.quorum { ret.cfg = *e2e.ConfigStandalone(ret.cfg) } - ret.cfg.DisableStrictReconfigCheck = ret.disableStrictReconfigCheck + ret.cfg.StrictReconfigCheck = !ret.disableStrictReconfigCheck if ret.initialCorruptCheck { ret.cfg.InitialCorruptCheck = ret.initialCorruptCheck } diff --git a/tests/framework/e2e/cluster.go b/tests/framework/e2e/cluster.go index ee46dd6b565..f8fe27e2e55 100644 --- a/tests/framework/e2e/cluster.go +++ b/tests/framework/e2e/cluster.go @@ -103,7 +103,7 @@ func NewConfigClientTLSCertAuthWithNoCN() *EtcdProcessClusterConfig { WithClusterSize(1), WithClientConnType(ClientTLS), WithClientCertAuthority(true), - WithNoCN(true), + WithCN(false), ) } @@ -152,18 +152,18 @@ type EtcdProcessClusterConfig struct { Client ClientConfig IsPeerTLS bool IsPeerAutoTLS bool - NoCN bool + CN bool CipherSuites []string - ForceNewCluster bool - InitialToken string - QuotaBackendBytes int64 - DisableStrictReconfigCheck bool - EnableV2 bool - InitialCorruptCheck bool - AuthTokenOpts string - V2deprecation string + ForceNewCluster bool + InitialToken string + QuotaBackendBytes int64 + StrictReconfigCheck bool + EnableV2 bool + InitialCorruptCheck bool + AuthTokenOpts string + V2deprecation string RollingStart bool @@ -186,8 +186,10 @@ type EtcdProcessClusterConfig struct { func DefaultConfig() *EtcdProcessClusterConfig { return &EtcdProcessClusterConfig{ - ClusterSize: 3, - InitialToken: "new", + ClusterSize: 3, + InitialToken: "new", + StrictReconfigCheck: true, + CN: true, } } @@ -257,16 +259,16 @@ func WithClientRevokeCerts(isClientCRL bool) EPClusterOption { return func(c *EtcdProcessClusterConfig) { c.Client.RevokeCerts = isClientCRL } } -func WithNoCN(noCN bool) EPClusterOption { - return func(c *EtcdProcessClusterConfig) { c.NoCN = noCN } +func WithCN(cn bool) EPClusterOption { + return func(c *EtcdProcessClusterConfig) { c.CN = cn } } func WithQuotaBackendBytes(bytes int64) EPClusterOption { return func(c *EtcdProcessClusterConfig) { c.QuotaBackendBytes = bytes } } -func WithDisableStrictReconfigCheck(disable bool) EPClusterOption { - return func(c *EtcdProcessClusterConfig) { c.DisableStrictReconfigCheck = disable } +func WithStrictReconfigCheck(strict bool) EPClusterOption { + return func(c *EtcdProcessClusterConfig) { c.StrictReconfigCheck = strict } } 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), ) } - if cfg.DisableStrictReconfigCheck { + if !cfg.StrictReconfigCheck { args = append(args, "--strict-reconfig-check=false") } if cfg.EnableV2 { diff --git a/tests/framework/e2e/curl.go b/tests/framework/e2e/curl.go index 46d829bf8ad..9b12a54abf3 100644 --- a/tests/framework/e2e/curl.go +++ b/tests/framework/e2e/curl.go @@ -64,7 +64,7 @@ func CURLPrefixArgs(cfg *EtcdProcessClusterConfig, member EtcdProcess, method st cmdArgs = append(cmdArgs, "--cacert", CaPath, "--cert", CertPath, "--key", PrivateKeyPath) acurl = ToTLS(member.Config().Acurl) } else if cfg.Client.ConnectionType == ClientTLS { - if !cfg.NoCN { + if cfg.CN { cmdArgs = append(cmdArgs, "--cacert", CaPath, "--cert", CertPath, "--key", PrivateKeyPath) } else { cmdArgs = append(cmdArgs, "--cacert", CaPath, "--cert", CertPath3, "--key", PrivateKeyPath3) diff --git a/tests/framework/e2e/e2e.go b/tests/framework/e2e/e2e.go index 12c22a86e77..1c3b1830335 100644 --- a/tests/framework/e2e/e2e.go +++ b/tests/framework/e2e/e2e.go @@ -48,7 +48,7 @@ func (e e2eRunner) NewCluster(ctx context.Context, t testing.TB, opts ...config. e2eConfig := NewConfig( WithClusterSize(cfg.ClusterSize), WithQuotaBackendBytes(cfg.QuotaBackendBytes), - WithDisableStrictReconfigCheck(!cfg.StrictReconfigCheck), + WithStrictReconfigCheck(cfg.StrictReconfigCheck), WithAuthTokenOpts(cfg.AuthToken), WithSnapshotCount(cfg.SnapshotCount), )