From 8f2b48465f7058b021d1d7e72b84da44f609a064 Mon Sep 17 00:00:00 2001 From: Gyu-Ho Lee Date: Fri, 30 Jun 2017 10:13:36 -0700 Subject: [PATCH] lease: stop lessors after tests Signed-off-by: Gyu-Ho Lee --- lease/lessor_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lease/lessor_test.go b/lease/lessor_test.go index e70c56d6b..7ea2972a9 100644 --- a/lease/lessor_test.go +++ b/lease/lessor_test.go @@ -42,6 +42,7 @@ func TestLessorGrant(t *testing.T) { defer be.Close() le := newLessor(be, minLeaseTTL) + defer le.Stop() le.Promote(0) l, err := le.Grant(1, 1) @@ -87,6 +88,7 @@ func TestLeaseConcurrentKeys(t *testing.T) { defer be.Close() le := newLessor(be, minLeaseTTL) + defer le.Stop() le.SetRangeDeleter(func() TxnDelete { return newFakeDeleter(be) }) // grant a lease with long term (100 seconds) to @@ -134,6 +136,7 @@ func TestLessorRevoke(t *testing.T) { defer be.Close() le := newLessor(be, minLeaseTTL) + defer le.Stop() var fd *fakeDeleter le.SetRangeDeleter(func() TxnDelete { fd = newFakeDeleter(be) @@ -185,6 +188,7 @@ func TestLessorRenew(t *testing.T) { defer os.RemoveAll(dir) le := newLessor(be, minLeaseTTL) + defer le.Stop() le.Promote(0) l, err := le.Grant(1, minLeaseTTL) @@ -240,6 +244,7 @@ func TestLessorRenewExtendPileup(t *testing.T) { be = backend.New(bcfg) defer be.Close() le = newLessor(be, minLeaseTTL) + defer le.Stop() // extend after recovery should extend expiration on lease pile-up le.Promote(0) @@ -268,6 +273,7 @@ func TestLessorDetach(t *testing.T) { defer be.Close() le := newLessor(be, minLeaseTTL) + defer le.Stop() le.SetRangeDeleter(func() TxnDelete { return newFakeDeleter(be) }) // grant a lease with long term (100 seconds) to @@ -307,6 +313,7 @@ func TestLessorRecover(t *testing.T) { defer be.Close() le := newLessor(be, minLeaseTTL) + defer le.Stop() l1, err1 := le.Grant(1, 10) l2, err2 := le.Grant(2, 20) if err1 != nil || err2 != nil { @@ -315,6 +322,7 @@ func TestLessorRecover(t *testing.T) { // Create a new lessor with the same backend nle := newLessor(be, minLeaseTTL) + defer nle.Stop() nl1 := nle.Lookup(l1.ID) if nl1 == nil || nl1.ttl != l1.ttl { t.Errorf("nl1 = %v, want nl1.ttl= %d", nl1.ttl, l1.ttl)