forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
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] Show Endpoint Host Isolation status on …
…endpoint list (elastic#101961) * Add endpoint isolation status for when multiple actions of different types are pending * Refactored List to break out Agent status code to separate component * Generator improvements for how actions are generated for Endpoints * Add HTTP mock for fleet EPM packages (to silence console errors) * new `.updateCommonInfo()` method to generator (to regenerate stateful data)
- Loading branch information
1 parent
6b99e66
commit 1b7a5a9
Showing
22 changed files
with
718 additions
and
118 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
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
56 changes: 56 additions & 0 deletions
56
.../public/common/components/endpoint/host_isolation/endpoint_host_isolation_status.test.tsx
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,56 @@ | ||
/* | ||
* 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 React from 'react'; | ||
import { | ||
EndpointHostIsolationStatus, | ||
EndpointHostIsolationStatusProps, | ||
} from './endpoint_host_isolation_status'; | ||
import { AppContextTestRender, createAppRootMockRenderer } from '../../../mock/endpoint'; | ||
|
||
describe('when using the EndpointHostIsolationStatus component', () => { | ||
let render: ( | ||
renderProps?: Partial<EndpointHostIsolationStatusProps> | ||
) => ReturnType<AppContextTestRender['render']>; | ||
|
||
beforeEach(() => { | ||
const appContext = createAppRootMockRenderer(); | ||
render = (renderProps = {}) => | ||
appContext.render( | ||
<EndpointHostIsolationStatus | ||
{...{ | ||
'data-test-subj': 'test', | ||
isIsolated: false, | ||
pendingUnIsolate: 0, | ||
pendingIsolate: 0, | ||
...renderProps, | ||
}} | ||
/> | ||
); | ||
}); | ||
|
||
it('should render `null` if not isolated and nothing is pending', () => { | ||
const renderResult = render(); | ||
expect(renderResult.container.textContent).toBe(''); | ||
}); | ||
|
||
it('should show `Isolated` when no pending actions and isolated', () => { | ||
const { getByTestId } = render({ isIsolated: true }); | ||
expect(getByTestId('test').textContent).toBe('Isolated'); | ||
}); | ||
|
||
it.each([ | ||
['Isolating pending', { pendingIsolate: 2 }], | ||
['Unisolating pending', { pendingUnIsolate: 2 }], | ||
['4 actions pending', { isIsolated: true, pendingUnIsolate: 2, pendingIsolate: 2 }], | ||
])('should show %s}', (expectedLabel, componentProps) => { | ||
const { getByTestId } = render(componentProps); | ||
expect(getByTestId('test').textContent).toBe(expectedLabel); | ||
// Validate that the text color is set to `subdued` | ||
expect(getByTestId('test-pending').classList.contains('euiTextColor--subdued')).toBe(true); | ||
}); | ||
}); |
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
Oops, something went wrong.