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

# Backport

This will backport the following commits from `main` to `8.12`:
- [[Serverless][Security Solution][Endpoint] Unskip file operations
tests (#171984)](https://github.com/elastic/kibana/pull/171984)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT
[{"author":{"name":"Ash","email":"1849116+ashokaditya@users.noreply.github.com"},"sourceCommit":{"committedDate":"2023-12-07T18:21:24Z","message":"[Serverless][Security
Solution][Endpoint] Unskip file operations tests (#171984)\n\n##
Summary\r\n\r\nUnskips file operation cypress tests\r\n\r\n**Flaky
runner**\r\n-\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4063\r\nx
100 ( 3 failures ) - 1 vagrant error, 1 file not found at path,
1\r\nwaiting on fleet server
error\r\n-\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4093\r\nx
100 ( 7 failures ) - file not found at
path\r\n-\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4129\r\nx
100 ( 6 failures ) - file not found at
path\r\n-\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4146\r\nx
100 ( 3 failures ) - file not found at
path\r\n-\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4208\r\nx
100 ( 5 failures ) - file not found at path\r\n\r\n_with longer file
read
timeout_\r\n(8281739e67bf549d4c54697bf79e2fa198071c52)\r\n-\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4218\r\nx
100 ( all pass )\r\n\r\n_with split assertions and
timeout_\r\n(74813ef815354ec1f2ccbfb43807f0150c1d20fa)\r\n-\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4228\r\nx
100 ( 6 fails )\r\n\r\n_with API wait_
(cc2cba95399582e2a24188b968e0729a8f83cdcc)\r\n-\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4253\r\nx
100 ( 1 failure related to fleet not available )\r\n\r\n###
Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\n---------\r\n\r\nSigned-off-by: Ash
<1849116+ashokaditya@users.noreply.github.com>","sha":"828ba66dd97926f29037a2083b7ce10f8acaa784","branchLabelMapping":{"^v8.13.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Defend
Workflows","OLM
Sprint","v8.12.0","v8.13.0"],"number":171984,"url":"https://github.com/elastic/kibana/pull/171984","mergeCommit":{"message":"[Serverless][Security
Solution][Endpoint] Unskip file operations tests (#171984)\n\n##
Summary\r\n\r\nUnskips file operation cypress tests\r\n\r\n**Flaky
runner**\r\n-\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4063\r\nx
100 ( 3 failures ) - 1 vagrant error, 1 file not found at path,
1\r\nwaiting on fleet server
error\r\n-\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4093\r\nx
100 ( 7 failures ) - file not found at
path\r\n-\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4129\r\nx
100 ( 6 failures ) - file not found at
path\r\n-\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4146\r\nx
100 ( 3 failures ) - file not found at
path\r\n-\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4208\r\nx
100 ( 5 failures ) - file not found at path\r\n\r\n_with longer file
read
timeout_\r\n(8281739e67bf549d4c54697bf79e2fa198071c52)\r\n-\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4218\r\nx
100 ( all pass )\r\n\r\n_with split assertions and
timeout_\r\n(74813ef815354ec1f2ccbfb43807f0150c1d20fa)\r\n-\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4228\r\nx
100 ( 6 fails )\r\n\r\n_with API wait_
(cc2cba95399582e2a24188b968e0729a8f83cdcc)\r\n-\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4253\r\nx
100 ( 1 failure related to fleet not available )\r\n\r\n###
Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\n---------\r\n\r\nSigned-off-by: Ash
<1849116+ashokaditya@users.noreply.github.com>","sha":"828ba66dd97926f29037a2083b7ce10f8acaa784"}},"sourceBranch":"main","suggestedTargetBranches":["8.12"],"targetPullRequestStates":[{"branch":"8.12","label":"v8.12.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.13.0","labelRegex":"^v8.13.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/171984","number":171984,"mergeCommit":{"message":"[Serverless][Security
Solution][Endpoint] Unskip file operations tests (#171984)\n\n##
Summary\r\n\r\nUnskips file operation cypress tests\r\n\r\n**Flaky
runner**\r\n-\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4063\r\nx
100 ( 3 failures ) - 1 vagrant error, 1 file not found at path,
1\r\nwaiting on fleet server
error\r\n-\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4093\r\nx
100 ( 7 failures ) - file not found at
path\r\n-\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4129\r\nx
100 ( 6 failures ) - file not found at
path\r\n-\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4146\r\nx
100 ( 3 failures ) - file not found at
path\r\n-\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4208\r\nx
100 ( 5 failures ) - file not found at path\r\n\r\n_with longer file
read
timeout_\r\n(8281739e67bf549d4c54697bf79e2fa198071c52)\r\n-\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4218\r\nx
100 ( all pass )\r\n\r\n_with split assertions and
timeout_\r\n(74813ef815354ec1f2ccbfb43807f0150c1d20fa)\r\n-\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4228\r\nx
100 ( 6 fails )\r\n\r\n_with API wait_
(cc2cba95399582e2a24188b968e0729a8f83cdcc)\r\n-\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4253\r\nx
100 ( 1 failure related to fleet not available )\r\n\r\n###
Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\n---------\r\n\r\nSigned-off-by: Ash
<1849116+ashokaditya@users.noreply.github.com>","sha":"828ba66dd97926f29037a2083b7ce10f8acaa784"}}]}]
BACKPORT-->

Co-authored-by: Ash <1849116+ashokaditya@users.noreply.github.com>
This commit is contained in:
Kibana Machine 2023-12-07 14:37:53 -05:00 committed by GitHub
parent c360cc9cb7
commit dde73ab426
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);
});
});