Fix some panics resulting from calling ExpirationManager.Stop directly. (#11547)
This commit is contained in:
parent
57b6e786fc
commit
0926e302c5
|
@ -2531,7 +2531,8 @@ func registerOneLease(t *testing.T, ctx context.Context, exp *ExpirationManager)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestExpiration_MarkIrrevocable(t *testing.T) {
|
func TestExpiration_MarkIrrevocable(t *testing.T) {
|
||||||
exp := mockExpiration(t)
|
c, _, _ := TestCoreUnsealed(t)
|
||||||
|
exp := c.expiration
|
||||||
ctx := namespace.RootContext(nil)
|
ctx := namespace.RootContext(nil)
|
||||||
|
|
||||||
leaseID := registerOneLease(t, ctx, exp)
|
leaseID := registerOneLease(t, ctx, exp)
|
||||||
|
@ -2570,7 +2571,7 @@ func TestExpiration_MarkIrrevocable(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// stop and restore to verify that irrevocable leases are properly loaded from storage
|
// stop and restore to verify that irrevocable leases are properly loaded from storage
|
||||||
err = exp.Stop()
|
err = c.stopExpiration()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("error stopping expiration manager: %v", err)
|
t.Fatalf("error stopping expiration manager: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -2646,7 +2647,8 @@ func TestExpiration_FetchLeaseTimesIrrevocable(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestExpiration_StopClearsIrrevocableCache(t *testing.T) {
|
func TestExpiration_StopClearsIrrevocableCache(t *testing.T) {
|
||||||
exp := mockExpiration(t)
|
c, _, _ := TestCoreUnsealed(t)
|
||||||
|
exp := c.expiration
|
||||||
ctx := namespace.RootContext(nil)
|
ctx := namespace.RootContext(nil)
|
||||||
|
|
||||||
leaseID := registerOneLease(t, ctx, exp)
|
leaseID := registerOneLease(t, ctx, exp)
|
||||||
|
@ -2656,7 +2658,7 @@ func TestExpiration_StopClearsIrrevocableCache(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
exp.markLeaseIrrevocable(ctx, le, fmt.Errorf("test irrevocable error"))
|
exp.markLeaseIrrevocable(ctx, le, fmt.Errorf("test irrevocable error"))
|
||||||
err = exp.Stop()
|
err = c.stopExpiration()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("error stopping expiration manager: %v", err)
|
t.Fatalf("error stopping expiration manager: %v", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue