[Serverless][Security Solution][Endpoint] Unskip file operations tests (#171984)

## Summary

Unskips file operation cypress tests

**Flaky runner**
-
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4063
x 100 ( 3 failures ) - 1 vagrant error, 1 file not found at path, 1
waiting on fleet server error
-
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4093
x 100 ( 7 failures ) - file not found at path
-
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4129
x 100 ( 6 failures ) - file not found at path
-
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4146
x 100 ( 3 failures ) - file not found at path
-
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4208
x 100 ( 5 failures ) - file not found at path

_with longer file read timeout_
(8281739e67)
-
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4218
x 100 ( all pass )

_with split assertions and timeout_
(74813ef815)
-
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4228
x 100 ( 6 fails )

_with API wait_ (cc2cba9539)
-
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4253
x 100 ( 1 failure related to fleet not available )

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Signed-off-by: Ash <1849116+ashokaditya@users.noreply.github.com>
This commit is contained in:
Ash 2023-12-07 19:21:24 +01:00 committed by GitHub
parent be6fbc4dcc
commit 828ba66dd9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 19 deletions

View file

@ -66,6 +66,7 @@ export const getCypressBaseConfig = (
// grep related configs
grepFilterSpecs: true,
grepOmitFiltered: true,
IS_CI: process.env.CI,
},
e2e: {

View file

@ -26,9 +26,8 @@ describe('Response console', { tags: ['@ess', '@serverless'] }, () => {
login();
});
// FLAKY: https://github.com/elastic/kibana/issues/170482
describe.skip('File operations:', () => {
const homeFilePath = process.env.CI || true ? '/home/vagrant' : `/home/ubuntu`;
describe('File operations:', () => {
const homeFilePath = Cypress.env('IS_CI') ? '/home/vagrant' : '/home/ubuntu';
const fileContent = 'This is a test file for the get-file command.';
const filePath = `${homeFilePath}/test_file.txt`;
@ -68,38 +67,52 @@ describe('Response console', { tags: ['@ess', '@serverless'] }, () => {
});
it('"get-file --path" - should retrieve a file', () => {
const downloadsFolder = Cypress.config('downloadsFolder');
waitForEndpointListPageToBeLoaded(createdHost.hostname);
cy.task('createFileOnEndpoint', {
hostname: createdHost.hostname,
path: filePath,
content: fileContent,
});
// initiate get file action and wait for the API to complete
cy.intercept('api/endpoint/action/get_file').as('getFileAction');
openResponseConsoleFromEndpointList();
inputConsoleCommand(`get-file --path ${filePath}`);
submitCommand();
cy.getByTestSubj('getFileSuccess', { timeout: 60000 }).within(() => {
cy.wait('@getFileAction', { timeout: 60000 });
// verify that the file was retrieved
// and that the file download link is available
cy.getByTestSubj('getFileSuccess').within(() => {
cy.contains('File retrieved from the host.');
cy.contains('(ZIP file passcode: elastic)');
cy.contains(
'Files are periodically deleted to clear storage space. Download and save file locally if needed.'
);
cy.contains('Click here to download').click();
const downloadsFolder = Cypress.config('downloadsFolder');
cy.readFile(`${downloadsFolder}/upload.zip`);
cy.contains('Click here to download').should('exist');
});
cy.task('uploadFileToEndpoint', {
hostname: createdHost.hostname,
srcPath: `${downloadsFolder}/upload.zip`,
destPath: `${homeFilePath}/upload.zip`,
});
cy.contains('Click here to download').click();
cy.task('readZippedFileContentOnEndpoint', {
hostname: createdHost.hostname,
path: `${homeFilePath}/upload.zip`,
password: 'elastic',
}).then((unzippedFileContent) => {
expect(unzippedFileContent).to.equal(fileContent);
});
// wait for file to be downloaded
cy.readFile(`${downloadsFolder}/upload.zip`, { timeout: 120000 }).should('exist');
// move the zip file to VM
cy.task('uploadFileToEndpoint', {
hostname: createdHost.hostname,
srcPath: `${downloadsFolder}/upload.zip`,
destPath: `${homeFilePath}/upload.zip`,
});
// unzip the file and read its content
cy.task('readZippedFileContentOnEndpoint', {
hostname: createdHost.hostname,
path: `${homeFilePath}/upload.zip`,
password: 'elastic',
}).then((unzippedFileContent) => {
expect(unzippedFileContent).to.equal(fileContent);
});
});