Make manualStepDownCh a 1-buffered channel to ensure StepDown actually steps down in tests. (#9622)
This commit is contained in:
parent
fbe2a86693
commit
b6fd378ee8
|
@ -1494,7 +1494,7 @@ func (c *Core) unsealInternal(ctx context.Context, masterKey []byte) (bool, erro
|
||||||
} else {
|
} else {
|
||||||
// Go to standby mode, wait until we are active to unseal
|
// Go to standby mode, wait until we are active to unseal
|
||||||
c.standbyDoneCh = make(chan struct{})
|
c.standbyDoneCh = make(chan struct{})
|
||||||
c.manualStepDownCh = make(chan struct{})
|
c.manualStepDownCh = make(chan struct{}, 1)
|
||||||
c.standbyStopCh.Store(make(chan struct{}))
|
c.standbyStopCh.Store(make(chan struct{}))
|
||||||
go c.runStandby(c.standbyDoneCh, c.manualStepDownCh, c.standbyStopCh.Load().(chan struct{}))
|
go c.runStandby(c.standbyDoneCh, c.manualStepDownCh, c.standbyStopCh.Load().(chan struct{}))
|
||||||
}
|
}
|
||||||
|
|
|
@ -1250,7 +1250,7 @@ func TestCore_Standby_Seal(t *testing.T) {
|
||||||
|
|
||||||
func TestCore_StepDown(t *testing.T) {
|
func TestCore_StepDown(t *testing.T) {
|
||||||
// Create the first core and initialize it
|
// Create the first core and initialize it
|
||||||
logger = logging.NewVaultLogger(log.Trace)
|
logger = logging.NewVaultLogger(log.Trace).Named(t.Name())
|
||||||
|
|
||||||
inm, err := inmem.NewInmemHA(nil, logger)
|
inm, err := inmem.NewInmemHA(nil, logger)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1267,6 +1267,7 @@ func TestCore_StepDown(t *testing.T) {
|
||||||
HAPhysical: inmha.(physical.HABackend),
|
HAPhysical: inmha.(physical.HABackend),
|
||||||
RedirectAddr: redirectOriginal,
|
RedirectAddr: redirectOriginal,
|
||||||
DisableMlock: true,
|
DisableMlock: true,
|
||||||
|
Logger: logger.Named("core1"),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("err: %v", err)
|
t.Fatalf("err: %v", err)
|
||||||
|
@ -1305,6 +1306,7 @@ func TestCore_StepDown(t *testing.T) {
|
||||||
HAPhysical: inmha.(physical.HABackend),
|
HAPhysical: inmha.(physical.HABackend),
|
||||||
RedirectAddr: redirectOriginal2,
|
RedirectAddr: redirectOriginal2,
|
||||||
DisableMlock: true,
|
DisableMlock: true,
|
||||||
|
Logger: logger.Named("core2"),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("err: %v", err)
|
t.Fatalf("err: %v", err)
|
||||||
|
|
Loading…
Reference in a new issue