-
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 ] One discover security context functional tests (#…
…199818) ## Summary Fixes elastic/security-team#11112 Follow up to - #199279 Adds functional test for Security Profiles in One Discover. ### Checklist Delete any items that are not applicable to this PR. - [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: kibanamachine <[email protected]>
- Loading branch information
1 parent
b9addc2
commit 9619d61
Showing
7 changed files
with
172 additions
and
11 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
Validating CODEOWNERS rules …
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
28 changes: 28 additions & 0 deletions
28
x-pack/test_serverless/functional/test_suites/security/config.examples.context_awareness.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,28 @@ | ||
/* | ||
* 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 { createTestConfig } from '../../config.base'; | ||
|
||
export default createTestConfig({ | ||
serverlessProject: 'security', | ||
testFiles: [require.resolve('../common/discover/context_awareness')], | ||
junit: { | ||
reportName: | ||
'Serverless Security Discover Context Awareness Functional Tests - Example Profiles', | ||
}, | ||
kbnServerArgs: [ | ||
`--discover.experimental.enabledProfiles=${JSON.stringify([ | ||
'example-root-profile', | ||
'example-solution-view-root-profile', | ||
'example-data-source-profile', | ||
'example-document-profile', | ||
])}`, | ||
], | ||
// include settings from project controller | ||
// https://github.com/elastic/project-controller/blob/main/internal/project/observability/config/elasticsearch.yml | ||
esServerArgs: ['xpack.ml.dfa.enabled=false'], | ||
}); |
8 changes: 8 additions & 0 deletions
8
x-pack/test_serverless/functional/test_suites/security/constants.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,8 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
export const SECURITY_ES_ARCHIVES_DIR = 'x-pack/test/security_solution_cypress/es_archives'; |
86 changes: 86 additions & 0 deletions
86
...erverless/functional/test_suites/security/ftr/discover/context_awareness/cell_renderer.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,86 @@ | ||
/* | ||
* 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 kbnRison from '@kbn/rison'; | ||
import expect from '@kbn/expect'; | ||
import path from 'path'; | ||
import { FtrProviderContext } from '../../../../../ftr_provider_context'; | ||
import { SECURITY_ES_ARCHIVES_DIR } from '../../../constants'; | ||
|
||
export default function ({ getService, getPageObjects }: FtrProviderContext) { | ||
const PageObjects = getPageObjects(['common', 'timePicker', 'discover', 'svlCommonPage']); | ||
const testSubjects = getService('testSubjects'); | ||
const dataViews = getService('dataViews'); | ||
const esArchiver = getService('esArchiver'); | ||
const queryBar = getService('queryBar'); | ||
|
||
describe('security root profile', () => { | ||
before(async () => { | ||
await PageObjects.svlCommonPage.loginAsViewer(); | ||
await esArchiver.loadIfNeeded(path.join(SECURITY_ES_ARCHIVES_DIR, 'auditbeat_single')); | ||
}); | ||
|
||
after(async () => { | ||
await esArchiver.unload(path.join(SECURITY_ES_ARCHIVES_DIR, 'auditbeat_single')); | ||
}); | ||
|
||
describe('cell renderers', () => { | ||
describe('host.name', () => { | ||
describe('DataView mode', () => { | ||
it('should open host.name flyout', async () => { | ||
await PageObjects.common.navigateToActualUrl('discover', undefined, { | ||
ensureCurrentUrl: false, | ||
}); | ||
await dataViews.createFromSearchBar({ | ||
name: 'auditbeat-2022', | ||
adHoc: true, | ||
hasTimeField: true, | ||
}); | ||
await queryBar.setQuery('host.name: "siem-kibana"'); | ||
await queryBar.clickQuerySubmitButton(); | ||
await PageObjects.discover.waitUntilSearchingHasFinished(); | ||
await PageObjects.discover.dragFieldToTable('host.name'); | ||
expect((await PageObjects.discover.getColumnHeaders()).join(', ')).to.be( | ||
'@timestamp, host.name' | ||
); | ||
// security host.name button | ||
const hostName = await testSubjects.findAll('host-details-button', 2500); | ||
expect(hostName).to.have.length(1); | ||
await hostName[0].click(); | ||
await testSubjects.existOrFail('host-panel-header', { timeout: 2500 }); | ||
await testSubjects.existOrFail('asset-criticality-selector', { timeout: 2500 }); | ||
await testSubjects.existOrFail('observedEntity-accordion', { timeout: 2500 }); | ||
}); | ||
}); | ||
|
||
describe('ES|QL mode', () => { | ||
it('should open host.name flyout', async () => { | ||
const state = kbnRison.encode({ | ||
dataSource: { type: 'esql' }, | ||
|
||
query: { esql: 'from auditbeat-2022 | WHERE host.name == "siem-kibana"' }, | ||
}); | ||
|
||
await PageObjects.common.navigateToActualUrl('discover', `?_a=${state}`, { | ||
ensureCurrentUrl: false, | ||
}); | ||
await PageObjects.discover.waitUntilSearchingHasFinished(); | ||
await PageObjects.discover.dragFieldToTable('host.name'); | ||
expect((await PageObjects.discover.getColumnHeaders()).join(', ')).to.be('host.name'); | ||
// security host.name button | ||
const hostName = await testSubjects.findAll('host-details-button', 2500); | ||
expect(hostName).to.have.length(1); | ||
await hostName[0].click(); | ||
await testSubjects.existOrFail('host-panel-header', { timeout: 2500 }); | ||
await testSubjects.existOrFail('asset-criticality-selector', { timeout: 2500 }); | ||
await testSubjects.existOrFail('observedEntity-accordion', { timeout: 2500 }); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
} |
40 changes: 40 additions & 0 deletions
40
...k/test_serverless/functional/test_suites/security/ftr/discover/context_awareness/index.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,40 @@ | ||
/* | ||
* 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 { FtrProviderContext } from '../../../../../ftr_provider_context'; | ||
|
||
export default function ({ getService, getPageObjects, loadTestFile }: FtrProviderContext) { | ||
const esArchiver = getService('esArchiver'); | ||
const kibanaServer = getService('kibanaServer'); | ||
const PageObjects = getPageObjects(['timePicker', 'svlCommonPage']); | ||
const from = '2017-06-10T14:00:00.000Z'; | ||
const to = '2024-06-10T16:30:00.000Z'; | ||
|
||
describe('discover/security/context_awareness', function () { | ||
this.tags(['esGate']); | ||
|
||
before(async () => { | ||
await esArchiver.load('test/functional/fixtures/es_archiver/discover/context_awareness'); | ||
await kibanaServer.importExport.load( | ||
'test/functional/fixtures/kbn_archiver/discover/context_awareness' | ||
); | ||
await kibanaServer.uiSettings.update({ | ||
'timepicker:timeDefaults': `{ "from": "${from}", "to": "${to}"}`, | ||
}); | ||
}); | ||
|
||
after(async () => { | ||
await esArchiver.unload('test/functional/fixtures/es_archiver/discover/context_awareness'); | ||
await kibanaServer.importExport.unload( | ||
'test/functional/fixtures/kbn_archiver/discover/context_awareness' | ||
); | ||
await PageObjects.timePicker.resetDefaultAbsoluteRangeViaUiSettings(); | ||
}); | ||
|
||
loadTestFile(require.resolve('./cell_renderer')); | ||
}); | ||
} |