1- import { beforeAll , describe , expect , it } from 'vitest' ;
1+ import { afterAll , beforeAll , describe , expect , it } from 'vitest' ;
22import { v4 as uuidv4 } from 'uuid' ;
33import { createTestClient } from './create-test-client' ;
44import { StreamClient } from '../src/StreamClient' ;
55
66describe ( 'external storage CRUD API' , ( ) => {
77 let client : StreamClient ;
88 const storageName = `streamnodetest${ uuidv4 ( ) } ` ;
9+ const s3name = `streamnodetest-${ uuidv4 ( ) } ` ;
10+ const gcsName = `streamnodetest-${ uuidv4 ( ) } ` ;
11+ const azureName = `streamnodetest-${ uuidv4 ( ) } ` ;
912
1013 beforeAll ( ( ) => {
1114 client = createTestClient ( ) ;
@@ -46,7 +49,6 @@ describe('external storage CRUD API', () => {
4649 } ) ;
4750
4851 it ( 'docs snippets' , async ( ) => {
49- const s3name = `streamnodetest-${ uuidv4 ( ) } ` ;
5052 await client . createExternalStorage ( {
5153 name : s3name ,
5254 storage_type : 's3' ,
@@ -61,7 +63,6 @@ describe('external storage CRUD API', () => {
6163
6264 await client . deleteExternalStorage ( { name : s3name } ) ;
6365
64- const gcsName = `streamnodetest-${ uuidv4 ( ) } ` ;
6566 await client . createExternalStorage ( {
6667 bucket : 'my-bucket' ,
6768 name : gcsName ,
@@ -72,7 +73,6 @@ describe('external storage CRUD API', () => {
7273
7374 await client . deleteExternalStorage ( { name : gcsName } ) ;
7475
75- const azureName = `streamnodetest-${ uuidv4 ( ) } ` ;
7676 await client . createExternalStorage ( {
7777 name : azureName ,
7878 storage_type : 'abs' ,
@@ -88,4 +88,19 @@ describe('external storage CRUD API', () => {
8888
8989 await client . deleteExternalStorage ( { name : azureName } ) ;
9090 } ) ;
91+
92+ afterAll ( async ( ) => {
93+ try {
94+ await client . deleteExternalStorage ( { name : s3name } ) ;
95+ } catch ( error ) { }
96+ try {
97+ await client . deleteExternalStorage ( { name : gcsName } ) ;
98+ } catch ( error ) { }
99+ try {
100+ await client . deleteExternalStorage ( { name : azureName } ) ;
101+ } catch ( error ) { }
102+ try {
103+ await client . deleteExternalStorage ( { name : storageName } ) ;
104+ } catch ( error ) { }
105+ } ) ;
91106} ) ;
0 commit comments