@@ -10,6 +10,7 @@ import {
1010 SETUP_TIMEOUT ,
1111} from "../../common/constants" ;
1212import { test as setup } from "../fixtures" ;
13+ import { uploadSboms } from "../helpers/upload" ;
1314
1415setup . describe ( "Ingest initial data" , ( ) => {
1516 setup . skip (
@@ -21,26 +22,12 @@ setup.describe("Ingest initial data", () => {
2122 setup . setTimeout ( SETUP_TIMEOUT ) ;
2223
2324 logger . info ( "Setup: start uploading assets" ) ;
24- await uploadSboms ( axios , SBOM_FILES ) ;
25+ await uploadSboms ( axios , SBOM_FILES , "../../common/assets/sbom/" ) ;
2526 await uploadAdvisories ( axios , ADVISORY_FILES ) ;
2627 logger . info ( "Setup: upload finished successfully" ) ;
2728 } ) ;
2829} ) ;
2930
30- const uploadSboms = async ( axios : AxiosInstance , files : string [ ] ) => {
31- const uploads = files . map ( ( e ) => {
32- const filePath = path . join ( __dirname , `../../common/assets/sbom/${ e } ` ) ;
33- fs . statSync ( filePath ) ; // Verify file exists
34-
35- const fileStream = fs . createReadStream ( filePath ) ;
36- return axios . post ( "/api/v2/sbom" , fileStream , {
37- headers : { "Content-Type" : "application/json+bzip2" } ,
38- } ) ;
39- } ) ;
40-
41- await Promise . all ( uploads ) ;
42- } ;
43-
4431const uploadAdvisories = async ( axios : AxiosInstance , files : string [ ] ) => {
4532 const uploads = files . map ( ( e ) => {
4633 const filePath = path . join ( __dirname , `../../common/assets/csaf/${ e } ` ) ;
0 commit comments