From 3b34e8017bc7597254b163cc6b810269dd1c13f1 Mon Sep 17 00:00:00 2001 From: Benjamin Wang Date: Fri, 26 Aug 2022 08:16:47 +0800 Subject: [PATCH] Cleanup some e2e test configurations 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 --- tests/e2e/corrupt_test.go | 8 ++++---- tests/e2e/ctl_v3_test.go | 31 +++++-------------------------- tests/framework/e2e/cluster.go | 18 +++++++++--------- 3 files changed, 18 insertions(+), 39 deletions(-) diff --git a/tests/e2e/corrupt_test.go b/tests/e2e/corrupt_test.go index 795ef99df1c4..5179492c5255 100644 --- a/tests/e2e/corrupt_test.go +++ b/tests/e2e/corrupt_test.go @@ -41,7 +41,6 @@ func TestEtcdCorruptHash(t *testing.T) { testCtl(t, corruptTest, withQuorum(), withCfg(*cfg), - withInitialCorruptCheck(), withCorruptFunc(testutil.CorruptBBolt), ) } @@ -101,9 +100,10 @@ func TestPeriodicCheckDetectsCorruption(t *testing.T) { checkTime := time.Second e2e.BeforeTest(t) epc, err := e2e.NewEtcdProcessCluster(t, &e2e.EtcdProcessClusterConfig{ - ClusterSize: 3, - KeepDataDir: true, - CorruptCheckTime: time.Second, + ClusterSize: 3, + KeepDataDir: true, + DisableInitialCorruptCheck: true, + CorruptCheckTime: time.Second, }) if err != nil { t.Fatalf("could not start etcd process cluster (%v)", err) diff --git a/tests/e2e/ctl_v3_test.go b/tests/e2e/ctl_v3_test.go index 20e4362f491a..45ceebcd4653 100644 --- a/tests/e2e/ctl_v3_test.go +++ b/tests/e2e/ctl_v3_test.go @@ -121,12 +121,11 @@ func dialWithSchemeTest(cx ctlCtx) { } type ctlCtx struct { - t *testing.T - apiPrefix string - cfg e2e.EtcdProcessClusterConfig - quotaBackendBytes int64 - corruptFunc func(string) error - noStrictReconfig bool + t *testing.T + apiPrefix string + cfg e2e.EtcdProcessClusterConfig + corruptFunc func(string) error + noStrictReconfig bool epc *e2e.EtcdProcessCluster @@ -141,11 +140,6 @@ type ctlCtx struct { user string pass string - initialCorruptCheck bool - - // for compaction - compactPhysical bool - // dir that was used during the test dataDir string } @@ -156,7 +150,6 @@ func (cx *ctlCtx) applyOpts(opts []ctlOption) { for _, opt := range opts { opt(cx) } - cx.initialCorruptCheck = true } func withCfg(cfg e2e.EtcdProcessClusterConfig) ctlOption { @@ -179,14 +172,6 @@ func withInteractive() ctlOption { return func(cx *ctlCtx) { cx.interactive = true } } -func withQuota(b int64) ctlOption { - return func(cx *ctlCtx) { cx.quotaBackendBytes = b } -} - -func withInitialCorruptCheck() ctlOption { - return func(cx *ctlCtx) { cx.initialCorruptCheck = true } -} - func withCorruptFunc(f func(string) error) ctlOption { return func(cx *ctlCtx) { cx.corruptFunc = f } } @@ -232,13 +217,7 @@ func testCtlWithOffline(t *testing.T, testFunc func(ctlCtx), testOfflineFunc fun if !ret.quorum { ret.cfg = *e2e.ConfigStandalone(ret.cfg) } - if ret.quotaBackendBytes > 0 { - ret.cfg.QuotaBackendBytes = ret.quotaBackendBytes - } ret.cfg.NoStrictReconfig = ret.noStrictReconfig - if ret.initialCorruptCheck { - ret.cfg.InitialCorruptCheck = ret.initialCorruptCheck - } if testOfflineFunc != nil { ret.cfg.KeepDataDir = true } diff --git a/tests/framework/e2e/cluster.go b/tests/framework/e2e/cluster.go index fb4b64a73924..edb8ca983c5c 100644 --- a/tests/framework/e2e/cluster.go +++ b/tests/framework/e2e/cluster.go @@ -165,14 +165,14 @@ type EtcdProcessClusterConfig struct { CipherSuites []string - ForceNewCluster bool - InitialToken string - QuotaBackendBytes int64 - NoStrictReconfig bool - EnableV2 bool - InitialCorruptCheck bool - AuthTokenOpts string - V2deprecation string + ForceNewCluster bool + InitialToken string + QuotaBackendBytes int64 + NoStrictReconfig bool + EnableV2 bool + DisableInitialCorruptCheck bool + AuthTokenOpts string + V2deprecation string RollingStart bool @@ -322,7 +322,7 @@ func (cfg *EtcdProcessClusterConfig) EtcdServerProcessConfigs(tb testing.TB) []* if cfg.EnableV2 { args = append(args, "--enable-v2") } - if cfg.InitialCorruptCheck { + if !cfg.DisableInitialCorruptCheck { args = append(args, "--experimental-initial-corrupt-check") } var murl string