@@ -83,8 +83,9 @@ async function run() {
8383 } ,
8484 } ;
8585
86- const archivesDir = path . join ( __dirname , '.archives' ) ;
8786 const root = path . join ( __dirname , '../../../../..' ) ;
87+ const commonDir = path . join ( root , 'x-pack/test/apm_api_integration/common' ) ;
88+ const archivesDir = path . join ( commonDir , 'fixtures/es_archiver' ) ;
8889
8990 // create the archive
9091
@@ -98,67 +99,30 @@ async function run() {
9899 }
99100 ) ;
100101
101- const targetDirs = [ 'trial' , 'basic' ] ;
102-
103- // copy the archives to the test fixtures
104-
105- await Promise . all (
106- targetDirs . map ( async ( target ) => {
107- const targetPath = path . resolve (
108- __dirname ,
109- '../../../../test/apm_api_integration/' ,
110- target
111- ) ;
112- const targetArchivesPath = path . resolve (
113- targetPath ,
114- 'fixtures/es_archiver' ,
115- archiveName
116- ) ;
117-
118- if ( ! fs . existsSync ( targetArchivesPath ) ) {
119- fs . mkdirSync ( targetArchivesPath ) ;
120- }
121-
122- fs . copyFileSync (
123- path . join ( archivesDir , archiveName , 'data.json.gz' ) ,
124- path . join ( targetArchivesPath , 'data.json.gz' )
125- ) ;
126- fs . copyFileSync (
127- path . join ( archivesDir , archiveName , 'mappings.json' ) ,
128- path . join ( targetArchivesPath , 'mappings.json' )
129- ) ;
130-
131- const currentConfig = { } ;
132-
133- // get the current metadata and extend/override metadata for the new archive
134- const configFilePath = path . join ( targetPath , 'archives_metadata.ts' ) ;
135-
136- try {
137- Object . assign ( currentConfig , ( await import ( configFilePath ) ) . default ) ;
138- } catch ( error ) {
139- // do nothing
140- }
141-
142- const newConfig = {
143- ...currentConfig ,
144- [ archiveName ] : {
145- start : gte ,
146- end : lt ,
147- } ,
148- } ;
149-
150- fs . writeFileSync (
151- configFilePath ,
152- `export default ${ JSON . stringify ( newConfig , null , 2 ) } ` ,
153- { encoding : 'utf-8' }
154- ) ;
155- } )
156- ) ;
102+ const currentConfig = { } ;
103+
104+ // get the current metadata and extend/override metadata for the new archive
105+ const configFilePath = path . join ( commonDir , 'archives_metadata.ts' ) ;
106+
107+ try {
108+ Object . assign ( currentConfig , ( await import ( configFilePath ) ) . default ) ;
109+ } catch ( error ) {
110+ // do nothing
111+ }
157112
158- fs . unlinkSync ( path . join ( archivesDir , archiveName , 'data.json.gz' ) ) ;
159- fs . unlinkSync ( path . join ( archivesDir , archiveName , 'mappings.json' ) ) ;
160- fs . rmdirSync ( path . join ( archivesDir , archiveName ) ) ;
161- fs . rmdirSync ( archivesDir ) ;
113+ const newConfig = {
114+ ...currentConfig ,
115+ [ archiveName ] : {
116+ start : gte ,
117+ end : lt ,
118+ } ,
119+ } ;
120+
121+ fs . writeFileSync (
122+ configFilePath ,
123+ `export default ${ JSON . stringify ( newConfig , null , 2 ) } ` ,
124+ { encoding : 'utf-8' }
125+ ) ;
162126
163127 // run ESLint on the generated metadata files
164128
0 commit comments