File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -359,7 +359,10 @@ exports = module.exports = internals.Core = class {
359
359
await this . _unlisten ( options ) ;
360
360
}
361
361
362
- this . caches . forEach ( ( cache ) => cache . client . stop ( ) ) ;
362
+ const caches = [ ] ;
363
+ this . caches . forEach ( ( cache ) => caches . push ( cache . client . stop ( ) ) ) ;
364
+ await Promise . all ( caches ) ;
365
+
363
366
await this . events . emit ( 'stop' ) ;
364
367
this . heavy . stop ( ) ;
365
368
await this . _invoke ( 'onPostStop' ) ;
Original file line number Diff line number Diff line change @@ -531,6 +531,23 @@ describe('Core', () => {
531
531
await expect ( server . stop ( ) ) . to . reject ( 'Cannot stop server while in stopping phase' ) ;
532
532
await stopping ;
533
533
} ) ;
534
+
535
+ it ( 'errors on bad cache stop' , async ( ) => {
536
+
537
+ const cache = {
538
+ engine : {
539
+ start : function ( ) { } ,
540
+ stop : function ( ) {
541
+
542
+ throw new Error ( 'oops' ) ;
543
+ }
544
+ }
545
+ } ;
546
+
547
+ const server = Hapi . server ( { cache } ) ;
548
+ await server . start ( ) ;
549
+ await expect ( server . stop ( ) ) . to . reject ( 'oops' ) ;
550
+ } ) ;
534
551
} ) ;
535
552
536
553
describe ( '_init()' , ( ) => {
You can’t perform that action at this time.
0 commit comments