Skip to content

Commit

Permalink
e2e: test 'lease timetolive'
Browse files Browse the repository at this point in the history
  • Loading branch information
gyuho committed Sep 7, 2016
1 parent 4e2bc8c commit 53351e2
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions e2e/ctl_v3_lease_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,32 @@ 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, id) {
cx.t.Fatalf("expected leaseID %q, got %q", id, line)
}
}

func leaseTestKeepAlive(cx ctlCtx) {
// put with TTL 10 seconds and keep-alive
Expand Down

0 comments on commit 53351e2

Please sign in to comment.