@@ -158,9 +158,9 @@ afterEach(async () => {
158158afterAll ( async ( ) => {
159159 try {
160160 // By exact name: some are named like the start of another object's ID.
161- for ( const container of containers ) removeByName ( 'container' , container ) ;
162- for ( const network of networks ) removeByName ( 'network' , network ) ;
163- for ( const volume of volumes ) removeByName ( 'volume' , volume ) ;
161+ for ( const container of containers ) removeByName ( 'container' , container , 'afterAll' ) ;
162+ for ( const network of networks ) removeByName ( 'network' , network , 'afterAll' ) ;
163+ for ( const volume of volumes ) removeByName ( 'volume' , volume , 'afterAll' ) ;
164164 // Each step, even when an earlier one fails: storage left here is found by the sweep below only by its label, and
165165 // every failure is reported.
166166 const failures : unknown [ ] = [ ] ;
@@ -832,17 +832,17 @@ describe('real Docker agent isolation', () => {
832832 // is gone says nothing.
833833 const warn = vi . spyOn ( console , 'warn' ) . mockImplementation ( ( ) => undefined ) ;
834834 try {
835- for ( const [ kind , name ] of byName ) removeByName ( kind , name ) ;
835+ for ( const [ kind , name ] of byName ) removeByName ( kind , name , 'test' ) ;
836836 expect ( byName . filter ( ( [ kind , name ] ) => spawnSync ( 'docker' , [ kind , 'inspect' , name ] , { stdio : 'ignore' } ) . status === 0 ) ) . toEqual ( [ ] ) ;
837- for ( const [ kind , name ] of byName ) removeByName ( kind , name ) ;
837+ for ( const [ kind , name ] of byName ) removeByName ( kind , name , 'test' ) ;
838838 expect ( warn ) . not . toHaveBeenCalled ( ) ;
839839 } finally { warn . mockRestore ( ) ; }
840840 // A missing name that Docker resolves to a live object's ID, as a tracked name gone since would be: removeByName
841841 // must leave that object alone. The network has no endpoints, so Docker would remove it if asked.
842842 expect ( docker ( 'network' , 'inspect' , '--format' , '{{.Id}}' , lookalike . slice ( 0 , 12 ) ) ) . toBe ( lookalike ) ;
843- removeByName ( 'network' , lookalike . slice ( 0 , 12 ) ) ;
843+ removeByName ( 'network' , lookalike . slice ( 0 , 12 ) , 'test' ) ;
844844 expect ( docker ( 'container' , 'inspect' , '--format' , '{{.Id}}' , bystanders [ 0 ] ! . slice ( 0 , 12 ) ) ) . toBe ( bystanders [ 0 ] ) ;
845- removeByName ( 'container' , bystanders [ 0 ] ! . slice ( 0 , 12 ) ) ;
845+ removeByName ( 'container' , bystanders [ 0 ] ! . slice ( 0 , 12 ) , 'test' ) ;
846846 const exists = ( kind : string , ref : string ) => spawnSync ( 'docker' , [ kind , 'inspect' , ref ] , { stdio : 'ignore' } ) . status === 0 ;
847847 for ( const holder of holders ) expect ( exists ( 'container' , holder ) ) . toBe ( false ) ;
848848 expect ( [ exists ( 'network' , network ) , exists ( 'network' , prefixNamed ) , exists ( 'volume' , volume ) ] ) . toEqual ( [ false , false , false ] ) ;
@@ -853,7 +853,7 @@ describe('real Docker agent isolation', () => {
853853 } finally {
854854 // By exact name: some are named like the start of another object's ID. Containers first, as they hold the rest.
855855 for ( const { kind, ref } of [ ...made . filter ( object => object . kind === 'container' ) , ...made . filter ( object => object . kind !== 'container' ) ] )
856- removeByName ( kind , ref ) ;
856+ removeByName ( kind , ref , 'finally' ) ;
857857 }
858858 // The budget covers the sweep's worst case (5.5 minutes) and ordinary Docker calls, removals by name included, not
859859 // every call at its own limit.
0 commit comments