Skip to content

Commit

Permalink
Add test in e2e for experimental corrupt check time flag
Browse files Browse the repository at this point in the history
Signed-off-by: Gang Li <[email protected]>
  • Loading branch information
gangli113 committed Jan 10, 2025
1 parent a8b4c3f commit 52b6552
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tests/e2e/corrupt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,27 @@ func TestInPlaceRecovery(t *testing.T) {
}

func TestPeriodicCheckDetectsCorruption(t *testing.T) {
testPeriodicCheckDetectsCorruption(t, false)
}

func TestPeriodicCheckDetectsCorruptionWithExperimentalFlag(t *testing.T) {
testPeriodicCheckDetectsCorruption(t, true)
}

func testPeriodicCheckDetectsCorruption(t *testing.T, useExperimentalFlag bool) {
checkTime := time.Second
e2e.BeforeTest(t)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
var corruptCheckTime e2e.EPClusterOption
if useExperimentalFlag {
corruptCheckTime = e2e.WithExperimentalCorruptCheckTime(time.Second)
} else {
corruptCheckTime = e2e.WithCorruptCheckTime(time.Second)
}
epc, err := e2e.NewEtcdProcessCluster(ctx, t,
e2e.WithKeepDataDir(true),
e2e.WithCorruptCheckTime(time.Second),
corruptCheckTime,
)
if err != nil {
t.Fatalf("could not start etcd process cluster (%v)", err)
Expand Down
6 changes: 6 additions & 0 deletions tests/framework/e2e/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,12 @@ func WithCorruptCheckTime(time time.Duration) EPClusterOption {
return func(c *EtcdProcessClusterConfig) { c.ServerConfig.CorruptCheckTime = time }
}

// Deprecated in v3.6 and will be decommissioned in v3.7.
// TODO: delete in v3.7
func WithExperimentalCorruptCheckTime(time time.Duration) EPClusterOption {
return func(c *EtcdProcessClusterConfig) { c.ServerConfig.ExperimentalCorruptCheckTime = time }
}

func WithInitialClusterToken(token string) EPClusterOption {
return func(c *EtcdProcessClusterConfig) { c.ServerConfig.InitialClusterToken = token }
}
Expand Down

0 comments on commit 52b6552

Please sign in to comment.