From e20412e4183aa02f02e225bac94092c5a0e8d786 Mon Sep 17 00:00:00 2001 From: Gloria Hornero Date: Thu, 14 Mar 2024 14:02:51 +0100 Subject: [PATCH] allowing to load ftr archives --- .../cypress/support/es_archiver.ts | 31 +++++++++++++++++-- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/x-pack/test/security_solution_cypress/cypress/support/es_archiver.ts b/x-pack/test/security_solution_cypress/cypress/support/es_archiver.ts index 083b30b12ae51..68fee1cdf8651 100644 --- a/x-pack/test/security_solution_cypress/cypress/support/es_archiver.ts +++ b/x-pack/test/security_solution_cypress/cypress/support/es_archiver.ts @@ -54,10 +54,35 @@ export const esArchiver = ( baseDir: '../es_archives', }); + const ftrEsArchiverInstance = new EsArchiver({ + log, + client, + kbnClient, + baseDir: '../../functional/es_archives', + }); + on('task', { - esArchiverLoad: async ({ archiveName, ...options }) => - esArchiverInstance.load(archiveName, options), - esArchiverUnload: async (archiveName) => esArchiverInstance.unload(archiveName), + esArchiverLoad: async ({ archiveName, type = 'cypress', ...options }) => { + if (type === 'cypress') { + esArchiverInstance.load(archiveName, options); + } else if (type === 'ftr') { + ftrEsArchiverInstance.load(archiveName, options); + } else { + throw new Error('It is not possible to load the archive.'); + } + return null; + }, + esArchiverUnload: async (archiveName, type = 'cypress') => { + esArchiverInstance.unload(archiveName); + if (type === 'cypress') { + esArchiverInstance.unload(archiveName); + } else if (type === 'ftr') { + ftrEsArchiverInstance.unload(archiveName); + } else { + throw new Error('It is not possible to load the archive.'); + } + return null; + }, }); return esArchiverInstance;