Skip to content

Commit

Permalink
Fix some panics resulting from calling ExpirationManager.Stop directl…
Browse files Browse the repository at this point in the history
  • Loading branch information
ncabatoff committed May 6, 2021
1 parent 428180a commit 401c565
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions vault/expiration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2531,7 +2531,8 @@ func registerOneLease(t *testing.T, ctx context.Context, exp *ExpirationManager)
}

func TestExpiration_MarkIrrevocable(t *testing.T) {
exp := mockExpiration(t)
c, _, _ := TestCoreUnsealed(t)
exp := c.expiration
ctx := namespace.RootContext(nil)

leaseID := registerOneLease(t, ctx, exp)
Expand Down Expand Up @@ -2570,7 +2571,7 @@ func TestExpiration_MarkIrrevocable(t *testing.T) {
}

// stop and restore to verify that irrevocable leases are properly loaded from storage
err = exp.Stop()
err = c.stopExpiration()
if err != nil {
t.Fatalf("error stopping expiration manager: %v", err)
}
Expand Down Expand Up @@ -2646,7 +2647,8 @@ func TestExpiration_FetchLeaseTimesIrrevocable(t *testing.T) {
}

func TestExpiration_StopClearsIrrevocableCache(t *testing.T) {
exp := mockExpiration(t)
c, _, _ := TestCoreUnsealed(t)
exp := c.expiration
ctx := namespace.RootContext(nil)

leaseID := registerOneLease(t, ctx, exp)
Expand All @@ -2656,7 +2658,7 @@ func TestExpiration_StopClearsIrrevocableCache(t *testing.T) {
}

exp.markLeaseIrrevocable(ctx, le, fmt.Errorf("test irrevocable error"))
err = exp.Stop()
err = c.stopExpiration()
if err != nil {
t.Fatalf("error stopping expiration manager: %v", err)
}
Expand Down

0 comments on commit 401c565

Please sign in to comment.