From 5bc43906febdb3b97966855a0106a555dec82d2b Mon Sep 17 00:00:00 2001 From: Benjamin Wang Date: Fri, 10 Jun 2022 15:38:37 +0800 Subject: [PATCH] Add e2e test case to cover leaseV2Renew and leaseV3Renew We need to support both v2Renew and v3Renew in 3.6, so we need to add test cases to verify both of them. Once the v2Renew is removed, then we can remove all related test case. Signed-off-by: Benjamin Wang --- tests/e2e/ctl_v3_lease_test.go | 10 +++++++++- tests/e2e/ctl_v3_test.go | 9 +++++++++ tests/framework/e2e/cluster.go | 4 ++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/tests/e2e/ctl_v3_lease_test.go b/tests/e2e/ctl_v3_lease_test.go index 6ac44c44f24..4b866652880 100644 --- a/tests/e2e/ctl_v3_lease_test.go +++ b/tests/e2e/ctl_v3_lease_test.go @@ -23,13 +23,21 @@ import ( "go.etcd.io/etcd/tests/v3/framework/e2e" ) -func TestCtlV3LeaseKeepAlive(t *testing.T) { testCtl(t, leaseTestKeepAlive) } +func TestCtlV3LeaseKeepAlive(t *testing.T) { + testCtl(t, leaseTestKeepAlive) +} +func TestCtlV3LeaseKeepAliveWithLeaseV2Renew(t *testing.T) { + testCtl(t, leaseTestKeepAlive, withLeaseV2Renew()) +} func TestCtlV3LeaseKeepAliveNoTLS(t *testing.T) { testCtl(t, leaseTestKeepAlive, withCfg(*e2e.NewConfigNoTLS())) } func TestCtlV3LeaseKeepAliveClientTLS(t *testing.T) { testCtl(t, leaseTestKeepAlive, withCfg(*e2e.NewConfigClientTLS())) } +func TestCtlV3LeaseKeepAliveClientTLSWithLeaseV2Renew(t *testing.T) { + testCtl(t, leaseTestKeepAlive, withCfg(*e2e.NewConfigClientTLS()), withLeaseV2Renew()) +} func TestCtlV3LeaseKeepAliveClientAutoTLS(t *testing.T) { testCtl(t, leaseTestKeepAlive, withCfg(*e2e.NewConfigClientAutoTLS())) } diff --git a/tests/e2e/ctl_v3_test.go b/tests/e2e/ctl_v3_test.go index 8b11cf6b516..c458c45eb44 100644 --- a/tests/e2e/ctl_v3_test.go +++ b/tests/e2e/ctl_v3_test.go @@ -142,6 +142,8 @@ type ctlCtx struct { initialCorruptCheck bool + enableLeaseV2Renew bool + // for compaction compactPhysical bool @@ -182,6 +184,10 @@ func withInitialCorruptCheck() ctlOption { return func(cx *ctlCtx) { cx.initialCorruptCheck = true } } +func withLeaseV2Renew() ctlOption { + return func(cx *ctlCtx) { cx.enableLeaseV2Renew = true } +} + func withCorruptFunc(f func(string) error) ctlOption { return func(cx *ctlCtx) { cx.corruptFunc = f } } @@ -226,6 +232,9 @@ func testCtlWithOffline(t *testing.T, testFunc func(ctlCtx), testOfflineFunc fun if ret.initialCorruptCheck { ret.cfg.InitialCorruptCheck = ret.initialCorruptCheck } + if ret.enableLeaseV2Renew { + ret.cfg.EnableLeaseV2Renew = ret.enableLeaseV2Renew + } if testOfflineFunc != nil { ret.cfg.KeepDataDir = true } diff --git a/tests/framework/e2e/cluster.go b/tests/framework/e2e/cluster.go index 4b1daf93d78..7546a39e3be 100644 --- a/tests/framework/e2e/cluster.go +++ b/tests/framework/e2e/cluster.go @@ -166,6 +166,7 @@ type EtcdProcessClusterConfig struct { NoStrictReconfig bool EnableV2 bool InitialCorruptCheck bool + EnableLeaseV2Renew bool AuthTokenOpts string V2deprecation string @@ -314,6 +315,9 @@ func (cfg *EtcdProcessClusterConfig) EtcdServerProcessConfigs(tb testing.TB) []* if cfg.InitialCorruptCheck { args = append(args, "--experimental-initial-corrupt-check") } + if cfg.EnableLeaseV2Renew { + args = append(args, "--experimental-enable-lease-v2-renew") + } var murl string if cfg.MetricsURLScheme != "" { murl = (&url.URL{