-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Defend Workflows][E2E]Endpoint e2e response console #155605
Merged
patrykkopycinski
merged 64 commits into
elastic:main
from
szwarckonrad:endpoint-e2e-response-console
May 2, 2023
Merged
Changes from 54 commits
Commits
Show all changes
64 commits
Select commit
Hold shift + click to select a range
2f884d5
avatar aria label
szwarckonrad 704886c
isolate command e2e coverage
szwarckonrad feab480
Merge branch 'main' into endpoint-isolate-e2e-coverage
szwarckonrad 5db6e07
typings
szwarckonrad 51b63c3
Merge branch 'main' into endpoint-isolate-e2e-coverage
szwarckonrad 4de9906
typings
szwarckonrad 67eb92c
cleanup
szwarckonrad 12874a1
Merge branch 'main' into endpoint-isolate-e2e-coverage
szwarckonrad fcc702f
use custom document generator
szwarckonrad 25674ff
Merge branch 'main' into endpoint-isolate-e2e-coverage
szwarckonrad 7c9043f
Merge branch 'main' into endpoint-isolate-e2e-coverage
szwarckonrad c54509b
manualy refresh result list
szwarckonrad d2fbb5d
Merge branch 'main' into endpoint-isolate-e2e-coverage
szwarckonrad 9415935
remove artifacts after endpoints.cy.ts test
szwarckonrad ac9e110
Merge branch 'main' into endpoint-isolate-e2e-coverage
szwarckonrad 193968b
backport isolate e2e tests to multipass
szwarckonrad f84233b
Merge branch 'main' into endpoint-isolate-e2e-coverage
szwarckonrad b3a7460
cleanup
szwarckonrad 345c733
Merge branch 'endpoint-isolate-e2e-coverage' into endpoint-isolate-e2…
szwarckonrad b5b6941
tweaks
szwarckonrad 62fa777
Merge branch 'main' into endpoint-isolate-e2e-coverage
szwarckonrad 5157dda
Merge branch 'endpoint-isolate-e2e-coverage' into endpoint-isolate-e2…
szwarckonrad 7c13a7e
cleanup
szwarckonrad 890c52c
test isolate and processes commands
szwarckonrad 678aaa7
Merge branch 'main' into endpoint-e2e-coverage-multipass
szwarckonrad 7aea2b5
Merge branch 'main' into endpoint-isolate-e2e-coverage-multipass
szwarckonrad 2b07574
type returns of helper functions
szwarckonrad 7b8fe2a
Merge branch 'endpoint-isolate-e2e-coverage-multipass' into endpoint-…
szwarckonrad 12b16d2
tweaks
szwarckonrad aef3b55
Merge branch 'main' into endpoint-e2e-coverage-multipass
szwarckonrad c6c32bd
Merge branch 'main' into endpoint-e2e-response-console
szwarckonrad 68f07c9
test
szwarckonrad 7d03f5c
Merge branch 'main' into endpoint-e2e-coverage-multipass
szwarckonrad d588d6d
fix action
patrykkopycinski f5ce24d
divide endpoint list checking function
szwarckonrad 9a6c19d
Merge branch 'endpoint-e2e-coverage-multipass' into endpoint-e2e-resp…
szwarckonrad 71a138e
e2e coverage
szwarckonrad 44e0b5c
Merge branch 'main' into endpoint-e2e-response-console
szwarckonrad 28e459e
Merge branch 'main' into endpoint-e2e-coverage-multipass
szwarckonrad 02d2c1c
Merge branch 'main' into endpoint-e2e-response-console
szwarckonrad 2a2ed44
Merge branch 'main' into endpoint-e2e-coverage-multipass
szwarckonrad 983e5dc
Merge branch 'main' into endpoint-e2e-response-console
szwarckonrad 9f74e8f
Merge branch 'main' into endpoint-e2e-coverage-multipass
szwarckonrad dc61a76
cleanup
szwarckonrad c0f3f24
naming
szwarckonrad 7f0526f
naming
szwarckonrad d826943
explicit types
szwarckonrad bdce83f
Merge branch 'main' into endpoint-e2e-coverage-multipass
szwarckonrad 513c616
Merge branch 'endpoint-e2e-coverage-multipass' into endpoint-e2e-resp…
szwarckonrad 9fef80e
Merge remote-tracking branch 'origin/endpoint-e2e-response-console' i…
szwarckonrad 4090b64
Merge branch 'main' into endpoint-e2e-response-console
szwarckonrad 6e7e9b5
Merge branch 'main' into endpoint-e2e-response-console
szwarckonrad 15c4521
explicit types
szwarckonrad 6b4639f
check for spawned endpoint on the endpoint list as there might be dan…
szwarckonrad 4f8b8a1
move response actions out of emulator scope
szwarckonrad bedfb41
Merge branch 'main' into endpoint-e2e-response-console
szwarckonrad 03cdf43
Merge branch 'main' into endpoint-e2e-response-console
szwarckonrad c8ff5be
Merge branch 'main' into endpoint-e2e-response-console
szwarckonrad ede434a
Merge branch 'main' into endpoint-e2e-response-console
patrykkopycinski 8d1d1b3
Merge branch 'main' into endpoint-e2e-response-console
szwarckonrad 4d5b6aa
Merge branch 'main' into endpoint-e2e-response-console
szwarckonrad 377e23d
Merge branch 'main' into endpoint-e2e-response-console
patrykkopycinski e62eaaf
Merge branch 'main' into endpoint-e2e-response-console
patrykkopycinski 857ee2e
Merge branch 'main' into endpoint-e2e-response-console
patrykkopycinski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
230 changes: 230 additions & 0 deletions
230
...lugins/security_solution/public/management/cypress/e2e/mocked_data/response_console.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,230 @@ | ||
/* | ||
* 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 { ActionDetails } from '../../../../../common/endpoint/types'; | ||
import type { ReturnTypeFromChainable } from '../../types'; | ||
import { indexEndpointHosts } from '../../tasks/index_endpoint_hosts'; | ||
import { | ||
checkReturnedProcessesTable, | ||
inputConsoleCommand, | ||
openResponseConsoleFromEndpointList, | ||
performCommandInputChecks, | ||
submitCommand, | ||
waitForEndpointListPageToBeLoaded, | ||
} from '../../tasks/response_console'; | ||
import { | ||
checkEndpointIsIsolated, | ||
checkEndpointIsNotIsolated, | ||
interceptActionRequests, | ||
sendActionResponse, | ||
} from '../../tasks/isolate'; | ||
import { login } from '../../tasks/login'; | ||
|
||
describe('Response console', () => { | ||
beforeEach(() => { | ||
login(); | ||
}); | ||
|
||
describe('Isolate command', () => { | ||
let endpointData: ReturnTypeFromChainable<typeof indexEndpointHosts>; | ||
let endpointHostname: string; | ||
let isolateRequestResponse: ActionDetails; | ||
|
||
before(() => { | ||
indexEndpointHosts({ withResponseActions: false, isolation: false }).then( | ||
(indexEndpoints) => { | ||
endpointData = indexEndpoints; | ||
endpointHostname = endpointData.data.hosts[0].host.name; | ||
} | ||
); | ||
}); | ||
|
||
after(() => { | ||
if (endpointData) { | ||
endpointData.cleanup(); | ||
// @ts-expect-error ignore setting to undefined | ||
endpointData = undefined; | ||
} | ||
}); | ||
|
||
it('should isolate host from response console', () => { | ||
waitForEndpointListPageToBeLoaded(endpointHostname); | ||
checkEndpointIsNotIsolated(endpointHostname); | ||
openResponseConsoleFromEndpointList(); | ||
performCommandInputChecks('isolate'); | ||
interceptActionRequests((responseBody) => { | ||
isolateRequestResponse = responseBody; | ||
}, 'isolate'); | ||
|
||
submitCommand(); | ||
cy.contains('Action pending.').should('exist'); | ||
cy.wait('@isolate').then(() => { | ||
sendActionResponse(isolateRequestResponse); | ||
}); | ||
cy.contains('Action completed.', { timeout: 120000 }).should('exist'); | ||
waitForEndpointListPageToBeLoaded(endpointHostname); | ||
checkEndpointIsIsolated(endpointHostname); | ||
}); | ||
}); | ||
|
||
describe('Release command', () => { | ||
let endpointData: ReturnTypeFromChainable<typeof indexEndpointHosts>; | ||
let endpointHostname: string; | ||
let releaseRequestResponse: ActionDetails; | ||
|
||
before(() => { | ||
indexEndpointHosts({ withResponseActions: false, isolation: true }).then((indexEndpoints) => { | ||
endpointData = indexEndpoints; | ||
endpointHostname = endpointData.data.hosts[0].host.name; | ||
}); | ||
}); | ||
|
||
after(() => { | ||
if (endpointData) { | ||
endpointData.cleanup(); | ||
// @ts-expect-error ignore setting to undefined | ||
endpointData = undefined; | ||
} | ||
}); | ||
|
||
it('should release host from response console', () => { | ||
waitForEndpointListPageToBeLoaded(endpointHostname); | ||
checkEndpointIsIsolated(endpointHostname); | ||
openResponseConsoleFromEndpointList(); | ||
performCommandInputChecks('release'); | ||
interceptActionRequests((responseBody) => { | ||
releaseRequestResponse = responseBody; | ||
}, 'release'); | ||
submitCommand(); | ||
cy.contains('Action pending.').should('exist'); | ||
cy.wait('@release').then(() => { | ||
sendActionResponse(releaseRequestResponse); | ||
}); | ||
cy.contains('Action completed.', { timeout: 120000 }).should('exist'); | ||
waitForEndpointListPageToBeLoaded(endpointHostname); | ||
checkEndpointIsNotIsolated(endpointHostname); | ||
}); | ||
}); | ||
|
||
describe('Processes command', () => { | ||
let endpointData: ReturnTypeFromChainable<typeof indexEndpointHosts>; | ||
let endpointHostname: string; | ||
let processesRequestResponse: ActionDetails; | ||
|
||
before(() => { | ||
indexEndpointHosts({ withResponseActions: false, isolation: false }).then( | ||
(indexEndpoints) => { | ||
endpointData = indexEndpoints; | ||
endpointHostname = endpointData.data.hosts[0].host.name; | ||
} | ||
); | ||
}); | ||
|
||
after(() => { | ||
if (endpointData) { | ||
endpointData.cleanup(); | ||
// @ts-expect-error ignore setting to undefined | ||
endpointData = undefined; | ||
} | ||
}); | ||
|
||
it('should return processes from response console', () => { | ||
waitForEndpointListPageToBeLoaded(endpointHostname); | ||
openResponseConsoleFromEndpointList(); | ||
performCommandInputChecks('processes'); | ||
interceptActionRequests((responseBody) => { | ||
processesRequestResponse = responseBody; | ||
}, 'processes'); | ||
submitCommand(); | ||
cy.contains('Action pending.').should('exist'); | ||
cy.wait('@processes').then(() => { | ||
sendActionResponse(processesRequestResponse); | ||
}); | ||
cy.getByTestSubj('getProcessesSuccessCallout', { timeout: 120000 }).within(() => { | ||
checkReturnedProcessesTable(); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('Kill process command', () => { | ||
let endpointData: ReturnTypeFromChainable<typeof indexEndpointHosts>; | ||
let endpointHostname: string; | ||
let killProcessRequestResponse: ActionDetails; | ||
|
||
before(() => { | ||
indexEndpointHosts({ withResponseActions: false, isolation: false }).then( | ||
(indexEndpoints) => { | ||
endpointData = indexEndpoints; | ||
endpointHostname = endpointData.data.hosts[0].host.name; | ||
} | ||
); | ||
}); | ||
|
||
after(() => { | ||
if (endpointData) { | ||
endpointData.cleanup(); | ||
// @ts-expect-error ignore setting to undefined | ||
endpointData = undefined; | ||
} | ||
}); | ||
|
||
it('should kill process from response console', () => { | ||
waitForEndpointListPageToBeLoaded(endpointHostname); | ||
openResponseConsoleFromEndpointList(); | ||
inputConsoleCommand(`kill-process --pid 1`); | ||
|
||
interceptActionRequests((responseBody) => { | ||
killProcessRequestResponse = responseBody; | ||
}, 'kill-process'); | ||
submitCommand(); | ||
cy.contains('Action pending.').should('exist'); | ||
cy.wait('@kill-process').then(() => { | ||
sendActionResponse(killProcessRequestResponse); | ||
}); | ||
cy.contains('Action completed.', { timeout: 120000 }).should('exist'); | ||
}); | ||
}); | ||
|
||
describe('Suspend process command', () => { | ||
let endpointData: ReturnTypeFromChainable<typeof indexEndpointHosts>; | ||
let endpointHostname: string; | ||
let suspendProcessRequestResponse: ActionDetails; | ||
|
||
before(() => { | ||
indexEndpointHosts({ withResponseActions: false, isolation: false }).then( | ||
(indexEndpoints) => { | ||
endpointData = indexEndpoints; | ||
endpointHostname = endpointData.data.hosts[0].host.name; | ||
} | ||
); | ||
}); | ||
|
||
after(() => { | ||
if (endpointData) { | ||
endpointData.cleanup(); | ||
// @ts-expect-error ignore setting to undefined | ||
endpointData = undefined; | ||
} | ||
}); | ||
|
||
it('should suspend process from response console', () => { | ||
waitForEndpointListPageToBeLoaded(endpointHostname); | ||
openResponseConsoleFromEndpointList(); | ||
inputConsoleCommand(`suspend-process --pid 1`); | ||
|
||
interceptActionRequests((responseBody) => { | ||
suspendProcessRequestResponse = responseBody; | ||
}, 'suspend-process'); | ||
submitCommand(); | ||
cy.contains('Action pending.').should('exist'); | ||
cy.wait('@suspend-process').then(() => { | ||
sendActionResponse(suspendProcessRequestResponse); | ||
}); | ||
cy.contains('Action completed.', { timeout: 120000 }).should('exist'); | ||
}); | ||
}); | ||
}); |
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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest you don't use services from
agent_meulator
because they are private to that utility. I would propose you refactor the ones you need and move them toscript/endpoint/common
.