@@ -19,26 +19,31 @@ let KEY_PREFIX;
1919let OBJ_KEY ;
2020
2121describe ( 'Ingesting existing data from RING S3C bucket' , ( ) => {
22- beforeEach ( ( ) => {
22+ beforeEach ( function ( ) {
2323 INGESTION_DEST_BUCKET = `ingestion-${ uuid ( ) } ` ;
2424 KEY_PREFIX = `${ ingestionSrcBucket } -${ uuid ( ) } ` ;
2525 OBJ_KEY = `${ KEY_PREFIX } /object-to-ingest-${ uuid ( ) } ` ;
26+ this . testState = {
27+ s3cBucketToClean : ingestionSrcBucket ,
28+ } ;
2629 } ) ;
2730
28- afterEach ( done => async . series ( [
29- next => ringS3CUtils . deleteAllVersions (
30- ingestionSrcBucket ,
31- null ,
32- next ,
33- ) ,
34- next => ringS3CUtils . putBucketVersioning (
35- ingestionSrcBucket ,
36- 'Enabled' ,
37- next ,
38- ) ,
39- next => scalityUtils . waitUntilEmpty ( INGESTION_DEST_BUCKET , next ) ,
40- next => scalityUtils . deleteVersionedBucket ( INGESTION_DEST_BUCKET , next ) ,
41- ] , done ) ) ;
31+ afterEach ( function ( done ) {
32+ async . series ( [
33+ next => ringS3CUtils . deleteAllVersions (
34+ this . testState . s3cBucketToClean ,
35+ null ,
36+ next ,
37+ ) ,
38+ next => ringS3CUtils . putBucketVersioning (
39+ this . testState . s3cBucketToClean ,
40+ 'Enabled' ,
41+ next ,
42+ ) ,
43+ next => scalityUtils . waitUntilEmpty ( INGESTION_DEST_BUCKET , next ) ,
44+ next => scalityUtils . deleteVersionedBucket ( INGESTION_DEST_BUCKET , next ) ,
45+ ] , done ) ;
46+ } ) ;
4247
4348 it ( 'should ingest an object' , done => async . waterfall ( [
4449 // object
@@ -366,28 +371,32 @@ describe('Ingesting existing data from RING S3C bucket', () => {
366371 // for the location to be created, and once it's versioned can't be set to non versioned again. This is
367372 // done to avoid having to create the location during the tests which might impact other tests running
368373 // in parallel.
369- it ( 'should ingest all non versioned objects' , done => async . waterfall ( [
370- next => scalityUtils . createIngestionBucket (
371- INGESTION_DEST_BUCKET ,
372- srcNonVersionedLocation ,
373- next ,
374- ) ,
375- next => ringS3CUtils . s3 . listObjectVersions ( {
376- Bucket : ingestionNonVersionedSrcBucket ,
377- } , next ) ,
378- ( data , next ) => {
379- assert . strictEqual ( data . Versions . length , nonVersionedObjectCount ) ;
380- assert . strictEqual ( data . DeleteMarkers . length , 0 ) ;
381- async . forEach ( data . Versions , ( version , cb ) => {
382- scalityUtils . compareObjectsRINGS3C (
383- ingestionNonVersionedSrcBucket ,
384- INGESTION_DEST_BUCKET ,
385- version . Key ,
386- 'null' ,
387- undefined ,
388- cb ,
389- ) ;
390- } , next ) ;
391- } ,
392- ] , done ) ) ;
374+ it ( 'should ingest all non versioned objects' , function ( done ) {
375+ this . testState . s3cBucketToClean = ingestionNonVersionedSrcBucket ;
376+ async . waterfall ( [
377+ next => scalityUtils . createIngestionBucket (
378+ INGESTION_DEST_BUCKET ,
379+ srcNonVersionedLocation ,
380+ next ,
381+ ) ,
382+ next => ringS3CUtils . s3 . listObjectVersions ( {
383+ Bucket : ingestionNonVersionedSrcBucket ,
384+ } , next ) ,
385+ ( data , next ) => {
386+ assert . strictEqual ( data . Versions . length , nonVersionedObjectCount ) ;
387+ assert . strictEqual ( data . DeleteMarkers . length , 0 ) ;
388+ async . forEach ( data . Versions , ( version , cb ) => {
389+ scalityUtils . compareObjectsRINGS3C (
390+ ingestionNonVersionedSrcBucket ,
391+ INGESTION_DEST_BUCKET ,
392+ version . Key ,
393+ 'null' ,
394+ undefined ,
395+ cb ,
396+ ) ;
397+ } , next ) ;
398+ } ,
399+ ] , done ) ;
400+ } ) ;
393401} ) ;
402+
0 commit comments