mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
e2e: test 'lease timetolive'
This commit is contained in:
parent
04a4cea630
commit
b7dc6cc604
@ -21,8 +21,35 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestCtlV3LeaseKeepAlive(t *testing.T) { testCtl(t, leaseTestKeepAlive) }
|
||||
func TestCtlV3LeaseRevoke(t *testing.T) { testCtl(t, leaseTestRevoke) }
|
||||
func TestCtlV3LeaseGrantTimeToLive(t *testing.T) { testCtl(t, leaseTestGrantTimeToLive) }
|
||||
func TestCtlV3LeaseKeepAlive(t *testing.T) { testCtl(t, leaseTestKeepAlive) }
|
||||
func TestCtlV3LeaseRevoke(t *testing.T) { testCtl(t, leaseTestRevoke) }
|
||||
|
||||
func leaseTestGrantTimeToLive(cx ctlCtx) {
|
||||
id, err := ctlV3LeaseGrant(cx, 10)
|
||||
if err != nil {
|
||||
cx.t.Fatal(err)
|
||||
}
|
||||
|
||||
cmdArgs := append(cx.PrefixArgs(), "lease", "timetolive", id, "--keys")
|
||||
proc, err := spawnCmd(cmdArgs)
|
||||
if err != nil {
|
||||
cx.t.Fatal(err)
|
||||
}
|
||||
line, err := proc.Expect(" granted with TTL(")
|
||||
if err != nil {
|
||||
cx.t.Fatal(err)
|
||||
}
|
||||
if err = proc.Close(); err != nil {
|
||||
cx.t.Fatal(err)
|
||||
}
|
||||
if !strings.Contains(line, ", attached keys") {
|
||||
cx.t.Fatalf("expected 'attached keys', got %q", line)
|
||||
}
|
||||
if !strings.Contains(line, id) {
|
||||
cx.t.Fatalf("expected leaseID %q, got %q", id, line)
|
||||
}
|
||||
}
|
||||
|
||||
func leaseTestKeepAlive(cx ctlCtx) {
|
||||
// put with TTL 10 seconds and keep-alive
|
||||
|
Loading…
x
Reference in New Issue
Block a user