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 {
|
||||
// Go to standby mode, wait until we are active to unseal
|
||||
c.standbyDoneCh = make(chan struct{})
|
||||
c.manualStepDownCh = make(chan struct{})
|
||||
c.manualStepDownCh = make(chan struct{}, 1)
|
||||
c.standbyStopCh.Store(make(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) {
|
||||
// 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)
|
||||
if err != nil {
|
||||
|
@ -1267,6 +1267,7 @@ func TestCore_StepDown(t *testing.T) {
|
|||
HAPhysical: inmha.(physical.HABackend),
|
||||
RedirectAddr: redirectOriginal,
|
||||
DisableMlock: true,
|
||||
Logger: logger.Named("core1"),
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
|
@ -1305,6 +1306,7 @@ func TestCore_StepDown(t *testing.T) {
|
|||
HAPhysical: inmha.(physical.HABackend),
|
||||
RedirectAddr: redirectOriginal2,
|
||||
DisableMlock: true,
|
||||
Logger: logger.Named("core2"),
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
|
|
Loading…
Reference in New Issue