Skip to content

Commit

Permalink
Add e2e test case to cover leaseV2Renew and leaseV3Renew
Browse files Browse the repository at this point in the history
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 <wachao@vmware.com>
  • Loading branch information
ahrtr committed Jun 14, 2022
1 parent c533cef commit 5bc4390
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/e2e/ctl_v3_lease_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
}
Expand Down
9 changes: 9 additions & 0 deletions tests/e2e/ctl_v3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ type ctlCtx struct {

initialCorruptCheck bool

enableLeaseV2Renew bool

// for compaction
compactPhysical bool

Expand Down Expand Up @@ -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 }
}
Expand Down Expand Up @@ -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
}
Expand Down
4 changes: 4 additions & 0 deletions tests/framework/e2e/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ type EtcdProcessClusterConfig struct {
NoStrictReconfig bool
EnableV2 bool
InitialCorruptCheck bool
EnableLeaseV2Renew bool
AuthTokenOpts string
V2deprecation string

Expand Down Expand Up @@ -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{
Expand Down

0 comments on commit 5bc4390

Please sign in to comment.