-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Security Solution][Endpoint] Fix and unskip test (#171719)
## Summary Fix and unskip isolation cypress test from response console - correctly does substring match when agent isolation state is `Isolated` - splits the tests so to avoid flaky states where the first test fails and on a re-run creates another agent and that fails the test as there are two agents on the list instead of one. fixes /issues/170470 **Flaky test runner** - https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4044 x 50 ( all pass ) - https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4049 x 150 ( all pass ) - https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4050 x 150 ( 1 fail ) _with split tests_ - https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4052 x 150 ( all pass ) _with action API for isolating host_ - https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4054 x 150 ( 1 failed, cancelled rest ) _with action retries_ - https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4055 x 150 ( all pass ) ### 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 --------- Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
- Loading branch information
1 parent
0c0ac93
commit bb34e1b
Showing
4 changed files
with
177 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
...ty_solution/public/management/cypress/e2e/response_actions/response_console/release.cy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import type { PolicyData } from '../../../../../../common/endpoint/types'; | ||
import type { CreateAndEnrollEndpointHostResponse } from '../../../../../../scripts/endpoint/common/endpoint_host_services'; | ||
import { | ||
openResponseConsoleFromEndpointList, | ||
performCommandInputChecks, | ||
submitCommand, | ||
waitForCommandToBeExecuted, | ||
waitForEndpointListPageToBeLoaded, | ||
} from '../../../tasks/response_console'; | ||
import type { IndexedFleetEndpointPolicyResponse } from '../../../../../../common/endpoint/data_loaders/index_fleet_endpoint_policy'; | ||
import { createAgentPolicyTask, getEndpointIntegrationVersion } from '../../../tasks/fleet'; | ||
import { | ||
checkEndpointListForOnlyIsolatedHosts, | ||
checkEndpointListForOnlyUnIsolatedHosts, | ||
isolateHostActionViaAPI, | ||
} from '../../../tasks/isolate'; | ||
|
||
import { login } from '../../../tasks/login'; | ||
import { enableAllPolicyProtections } from '../../../tasks/endpoint_policy'; | ||
import { createEndpointHost } from '../../../tasks/create_endpoint_host'; | ||
import { deleteAllLoadedEndpointData } from '../../../tasks/delete_all_endpoint_data'; | ||
|
||
describe('Response console', { tags: ['@ess', '@serverless'] }, () => { | ||
let indexedPolicy: IndexedFleetEndpointPolicyResponse; | ||
let policy: PolicyData; | ||
let createdHost: CreateAndEnrollEndpointHostResponse; | ||
|
||
before(() => { | ||
getEndpointIntegrationVersion().then((version) => | ||
createAgentPolicyTask(version).then((data) => { | ||
indexedPolicy = data; | ||
policy = indexedPolicy.integrationPolicies[0]; | ||
|
||
return enableAllPolicyProtections(policy.id).then(() => { | ||
// Create and enroll a new Endpoint host | ||
return createEndpointHost(policy.policy_id).then((host) => { | ||
createdHost = host as CreateAndEnrollEndpointHostResponse; | ||
}); | ||
}); | ||
}) | ||
); | ||
}); | ||
|
||
after(() => { | ||
if (createdHost) { | ||
cy.task('destroyEndpointHost', createdHost); | ||
} | ||
|
||
if (indexedPolicy) { | ||
cy.task('deleteIndexedFleetEndpointPolicies', indexedPolicy); | ||
} | ||
|
||
if (createdHost) { | ||
deleteAllLoadedEndpointData({ endpointAgentIds: [createdHost.agentId] }); | ||
} | ||
}); | ||
|
||
describe('Host Isolation:', () => { | ||
beforeEach(() => { | ||
login(); | ||
}); | ||
|
||
it('should release an isolated host via response console', () => { | ||
const command = 'release'; | ||
waitForEndpointListPageToBeLoaded(createdHost.hostname); | ||
// isolate the host first | ||
isolateHostActionViaAPI(createdHost.agentId); | ||
// verify and find the isolated host | ||
checkEndpointListForOnlyIsolatedHosts(); | ||
openResponseConsoleFromEndpointList(); | ||
performCommandInputChecks(command); | ||
submitCommand(); | ||
waitForCommandToBeExecuted(command); | ||
waitForEndpointListPageToBeLoaded(createdHost.hostname); | ||
checkEndpointListForOnlyUnIsolatedHosts(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters