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

## Summary

This PR tries to fix the following issues:

- https://github.com/elastic/kibana/issues/201686
- https://github.com/elastic/kibana/issues/210678
- https://github.com/elastic/kibana/issues/168904
- https://github.com/elastic/kibana/issues/191017


### 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
- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
This commit is contained in:
Alex Prozorov 2025-03-11 16:26:58 +02:00 committed by GitHub
parent e0bf98e45a
commit 2fd0bea441
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);
});
});
});
});