[9.0] [Cloud Security] add cleanup to rules v2 integrations and fix data views, compliance d… (#213669) (#213931)

# Backport

This will backport the following commits from `main` to `9.0`:
- [[Cloud Security] add cleanup to rules v2 integrations and fix data
views, compliance d…
(#213669)](https://github.com/elastic/kibana/pull/213669)

<!--- Backport version: 9.6.6 -->

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

<!--BACKPORT [{"author":{"name":"Alex
Prozorov","email":"alex.prozorov@elastic.co"},"sourceCommit":{"committedDate":"2025-03-11T14:26:58Z","message":"[Cloud
Security] add cleanup to rules v2 integrations and fix data views,
compliance d… (#213669)\n\n## Summary\n\nThis PR tries to fix the
following issues:\n\n-
https://github.com/elastic/kibana/issues/201686\n-
https://github.com/elastic/kibana/issues/210678\n-
https://github.com/elastic/kibana/issues/168904\n-
https://github.com/elastic/kibana/issues/191017\n\n\n### Checklist\n-
[x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [x] [Flaky
Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\nused on any tests
changed","sha":"2fd0bea4413af382709ed0c23c74b3a5954b5633","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:Cloud
Security","backport:prev-minor","v9.1.0"],"title":"[Cloud Security] add
cleanup to rules v2 integrations and fix data views, compliance
d…","number":213669,"url":"https://github.com/elastic/kibana/pull/213669","mergeCommit":{"message":"[Cloud
Security] add cleanup to rules v2 integrations and fix data views,
compliance d… (#213669)\n\n## Summary\n\nThis PR tries to fix the
following issues:\n\n-
https://github.com/elastic/kibana/issues/201686\n-
https://github.com/elastic/kibana/issues/210678\n-
https://github.com/elastic/kibana/issues/168904\n-
https://github.com/elastic/kibana/issues/191017\n\n\n### Checklist\n-
[x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [x] [Flaky
Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\nused on any tests
changed","sha":"2fd0bea4413af382709ed0c23c74b3a5954b5633"}},"sourceBranch":"main","suggestedTargetBranches":["9.0"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/213669","number":213669,"mergeCommit":{"message":"[Cloud
Security] add cleanup to rules v2 integrations and fix data views,
compliance d… (#213669)\n\n## Summary\n\nThis PR tries to fix the
following issues:\n\n-
https://github.com/elastic/kibana/issues/201686\n-
https://github.com/elastic/kibana/issues/210678\n-
https://github.com/elastic/kibana/issues/168904\n-
https://github.com/elastic/kibana/issues/191017\n\n\n### Checklist\n-
[x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [x] [Flaky
Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\nused on any tests
changed","sha":"2fd0bea4413af382709ed0c23c74b3a5954b5633"}}]}]
BACKPORT-->

Co-authored-by: Alex Prozorov <alex.prozorov@elastic.co>
This commit is contained in:
Kibana Machine 2025-03-12 03:17:53 +11:00 committed by GitHub
parent c68d82ee86
commit 495d0b93a0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 31 additions and 13 deletions

View file

@ -20,10 +20,20 @@ export default function ({ getService }: FtrProviderContext) {
describe('GET internal/cloud_security_posture/rules/_find', () => {
let agentPolicyId: string;
const savedObjects = [
'ingest-agent-policies',
'fleet-agent-policies',
'ingest-package-policies',
'fleet-package-policies',
'cloud-security-posture-settings',
];
before(async () => {
await esArchiver.load('x-pack/test/functional/es_archives/fleet/empty_fleet_server');
});
beforeEach(async () => {
await kibanaServer.savedObjects.cleanStandardList();
await esArchiver.load('x-pack/test/functional/es_archives/fleet/empty_fleet_server');
await kibanaServer.savedObjects.clean({ types: savedObjects });
const { body: agentPolicyResponse } = await supertest
.post(`/api/fleet/agent_policies`)
@ -98,7 +108,10 @@ export default function ({ getService }: FtrProviderContext) {
});
afterEach(async () => {
await kibanaServer.savedObjects.cleanStandardList();
await kibanaServer.savedObjects.clean({ types: savedObjects });
});
after(async () => {
await esArchiver.unload('x-pack/test/functional/es_archives/fleet/empty_fleet_server');
});

View file

@ -40,7 +40,7 @@ export default ({ getService, getPageObjects }: FtrProviderContext) => {
const kibanaServer = getService('kibanaServer');
const spacesService = getService('spaces');
const retry = getService('retry');
const fetchingOfDataViewsTimeout = 1000 * 20; // 20 seconds
const fetchingOfDataViewsTimeout = 1000 * 30; // 30 seconds
const pageObjects = getPageObjects([
'common',

View file

@ -19,6 +19,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
'header',
]);
const supertest = getService('supertest');
const retry = getService('retry');
describe('Serverless - Agentless CIS Integration Page', function () {
// TODO: we need to check if the tests are running on MKI. There is a suspicion that installing csp package via Kibana server args is not working on MKI.
@ -110,16 +111,18 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
expect(await cisIntegrationAws.showLaunchCloudFormationAgentlessButton()).to.be(true);
});
});
// FLAKY: https://github.com/elastic/kibana/issues/191017
describe.skip('Serverless - Agentless CIS_AWS Create flow', () => {
// turned back on after the fix for fleet form bug https://github.com/elastic/kibana/pull/211563 - need to monitor
describe('Serverless - Agentless CIS_AWS Create flow', () => {
it(`user should save agentless integration policy when there are no api or validation errors and button is not disabled`, async () => {
await cisIntegration.createAgentlessIntegration({
cloudProvider: 'aws',
});
expect(await cisIntegration.showSuccessfulToast('packagePolicyCreateSuccessToast')).to.be(
true
);
await retry.try(async () => {
expect(await cisIntegration.showSuccessfulToast('packagePolicyCreateSuccessToast')).to.be(
true
);
});
});
});
});

View file

@ -50,6 +50,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
cspDashboard = pageObjects.cloudPostureDashboard;
dashboard = pageObjects.cloudPostureDashboard.dashboard;
await cspDashboard.waitForPluginInitialized();
await cspDashboard.index.remove();
await cspDashboard.index.add(data);
await cspDashboard.navigateToComplianceDashboardPage();
@ -66,9 +67,10 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
describe('Kubernetes Dashboard', () => {
it('displays accurate summary compliance score', async () => {
await pageObjects.header.waitUntilLoadingHasFinished();
const scoreElement = await dashboard.getKubernetesComplianceScore();
expect((await scoreElement.getVisibleText()) === '0%').to.be(true);
await retry.try(async () => {
const scoreElement = await dashboard.getKubernetesComplianceScore();
expect((await scoreElement.getVisibleText()) === '0%').to.be(true);
});
});
});
});