mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdserver,integration: Store remaining TTL on checkpoint
To extend lease checkpointing mechanism to cases when the whole etcd cluster is restarted.
This commit is contained in:
committed by
Marek Siarkowicz
parent
21634a98c6
commit
eddfb4232f
@@ -235,6 +235,7 @@ func TestV3LeaseCheckpoint(t *testing.T) {
|
||||
ttl time.Duration
|
||||
checkpointingInterval time.Duration
|
||||
leaderChanges int
|
||||
clusterSize int
|
||||
expectTTLIsGT time.Duration
|
||||
expectTTLIsLT time.Duration
|
||||
}{
|
||||
@@ -242,6 +243,7 @@ func TestV3LeaseCheckpoint(t *testing.T) {
|
||||
name: "Checkpointing disabled, lease TTL is reset",
|
||||
ttl: 300 * time.Second,
|
||||
leaderChanges: 1,
|
||||
clusterSize: 3,
|
||||
expectTTLIsGT: 298 * time.Second,
|
||||
},
|
||||
{
|
||||
@@ -250,6 +252,16 @@ func TestV3LeaseCheckpoint(t *testing.T) {
|
||||
checkpointingEnabled: true,
|
||||
checkpointingInterval: 10 * time.Second,
|
||||
leaderChanges: 1,
|
||||
clusterSize: 3,
|
||||
expectTTLIsLT: 290 * time.Second,
|
||||
},
|
||||
{
|
||||
name: "Checkpointing enabled 10s, lease TTL is preserved after cluster restart",
|
||||
ttl: 300 * time.Second,
|
||||
checkpointingEnabled: true,
|
||||
checkpointingInterval: 10 * time.Second,
|
||||
leaderChanges: 1,
|
||||
clusterSize: 1,
|
||||
expectTTLIsLT: 290 * time.Second,
|
||||
},
|
||||
{
|
||||
@@ -259,6 +271,7 @@ func TestV3LeaseCheckpoint(t *testing.T) {
|
||||
checkpointingEnabled: true,
|
||||
checkpointingInterval: 10 * time.Second,
|
||||
leaderChanges: 2,
|
||||
clusterSize: 3,
|
||||
expectTTLIsLT: 280 * time.Second,
|
||||
},
|
||||
}
|
||||
@@ -266,7 +279,7 @@ func TestV3LeaseCheckpoint(t *testing.T) {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
BeforeTest(t)
|
||||
config := &ClusterConfig{
|
||||
Size: 3,
|
||||
Size: tc.clusterSize,
|
||||
EnableLeaseCheckpoint: tc.checkpointingEnabled,
|
||||
LeaseCheckpointInterval: tc.checkpointingInterval,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user