Skip to content

Commit

Permalink
[8.13] [Security Solution][Rule Management] Getting rid off before ho…
Browse files Browse the repository at this point in the history
…ok if is not loading an archive (#178891) (#179333)

# Backport

This will backport the following commits from `main` to `8.13`:
- [[Security Solution][Rule Management] Getting rid off before hook if
is not loading an archive
(#178891)](#178891)

<!--- Backport version: 9.4.3 -->

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

<!--BACKPORT [{"author":{"name":"Gloria
Hornero","email":"gloria.hornero@elastic.co"},"sourceCommit":{"committedDate":"2024-03-25T11:04:13Z","message":"[Security
Solution][Rule Management] Getting rid off before hook if is not loading
an archive (#178891)\n\n## Summary\r\n\r\nAddresses:
#175022
test suite runner
passed\r\nsuccessfully](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5522)","sha":"6f49ab85e81fe123338a1a0a61266fb7c67606f9","branchLabelMapping":{"^v8.14.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["test","test_ui_functional","release_note:skip","Team:Detections
and Resp","Team: SecuritySolution","Team:Detection Rule
Management","v8.14.0","v8.13.1"],"title":"[Security Solution][Rule
Management] Getting rid off before hook if is not loading an
archive","number":178891,"url":"#178891
Solution][Rule Management] Getting rid off before hook if is not loading
an archive (#178891)\n\n## Summary\r\n\r\nAddresses:
#175022
test suite runner
passed\r\nsuccessfully](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5522)","sha":"6f49ab85e81fe123338a1a0a61266fb7c67606f9"}},"sourceBranch":"main","suggestedTargetBranches":["8.13"],"targetPullRequestStates":[{"branch":"main","label":"v8.14.0","branchLabelMappingKey":"^v8.14.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/178891","number":178891,"mergeCommit":{"message":"[Security
Solution][Rule Management] Getting rid off before hook if is not loading
an archive (#178891)\n\n## Summary\r\n\r\nAddresses:
#175022
test suite runner
passed\r\nsuccessfully](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5522)","sha":"6f49ab85e81fe123338a1a0a61266fb7c67606f9"}},{"branch":"8.13","label":"v8.13.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Gloria Hornero <gloria.hornero@elastic.co>
Co-authored-by: Maxim Palenov <maxim.palenov@elastic.co>
  • Loading branch information
3 people committed Mar 29, 2024
1 parent 7f8e7d9 commit c30272f
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,14 @@ import {
} from '../../../../tasks/common/callouts';
import { login } from '../../../../tasks/login';
import { visitRulesManagementTable } from '../../../../tasks/rules_management';
import { deleteAlertsAndRules } from '../../../../tasks/api_calls/common';

// TODO: https://github.com/elastic/kibana/issues/164451 We should find a way to make this spec work in Serverless
// TODO: https://github.com/elastic/kibana/issues/161540
describe('All rules - read only', { tags: ['@ess', '@serverless', '@skipInServerless'] }, () => {
before(() => {
createRule(getNewRule({ rule_id: '1', enabled: false }));
});

beforeEach(() => {
deleteAlertsAndRules();
createRule(getNewRule({ rule_id: '1', enabled: false }));
login(ROLES.t1_analyst);
visitRulesManagementTable();
cy.get(RULE_NAME).should('have.text', getNewRule().name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,20 +238,17 @@ describe('Related integrations', { tags: ['@ess', '@serverless', '@brokenInServe
});

describe('related Integrations Advanced Setting is disabled', () => {
before(() => {
disableRelatedIntegrations();
});

after(() => {
enableRelatedIntegrations();
});

describe('rules management table', () => {
beforeEach(() => {
disableRelatedIntegrations();
visitRulesManagementTable();
disableAutoRefresh();
});

afterEach(() => {
enableRelatedIntegrations();
});

it('should not display a badge with the installed integrations', () => {
cy.get(RULE_NAME).should('have.text', PREBUILT_RULE_NAME);
cy.get(INTEGRATION_LINK).should('not.exist');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,21 @@ import { login } from '../../../../tasks/login';

import { createRule } from '../../../../tasks/api_calls/rules';
import { getNewRule } from '../../../../objects/rule';
import { deleteAlertsAndRules } from '../../../../tasks/api_calls/common';

const RULES_TABLE_REFRESH_INTERVAL_MS = 60000;

describe('Rules table: auto-refresh', { tags: ['@ess', '@serverless'] }, () => {
before(() => {
beforeEach(() => {
login();
deleteAlertsAndRules();
setRulesTableAutoRefreshIntervalSetting({
enabled: true,
refreshInterval: RULES_TABLE_REFRESH_INTERVAL_MS,
});
createRule(getNewRule({ name: 'Test rule 1', rule_id: '1', enabled: false }));
});

beforeEach(() => {
login();
});

it('gets deactivated when any rule selected and activated after rules unselected', () => {
visitRulesManagementTable();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import {
setRowsPerPageTo,
sortByTableColumn,
} from '../../../../tasks/table_pagination';
import { deleteAlertsAndRules } from '../../../../tasks/api_calls/common';

function createTestRules(): void {
createRule(getNewRule({ rule_id: '1', name: 'test 1', tags: ['tag-a'], enabled: false }));
Expand Down Expand Up @@ -96,11 +97,9 @@ function expectDefaultRulesTableState(): void {
}

describe('Rules table: persistent state', { tags: ['@ess', '@serverless'] }, () => {
before(() => {
createTestRules();
});

beforeEach(() => {
deleteAlertsAndRules();
createTestRules();
login();
resetRulesTableState();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,18 @@ import {
sortByTableColumn,
} from '../../../../tasks/table_pagination';
import { TABLE_FIRST_PAGE, TABLE_SECOND_PAGE } from '../../../../screens/table_pagination';
import { deleteAlertsAndRules } from '../../../../tasks/api_calls/common';

describe('Rules table: sorting', { tags: ['@ess', '@serverless'] }, () => {
before(() => {
beforeEach(() => {
login();
deleteAlertsAndRules();
createRule(getNewRule({ rule_id: '1', enabled: false }));
createRule(getExistingRule({ rule_id: '2', enabled: false }));
createRule(getNewOverrideRule({ rule_id: '3', enabled: false }));
createRule(getNewThresholdRule({ rule_id: '4', enabled: false }));
});

beforeEach(() => {
login();
});

it('Sorts by enabled rules', () => {
visit(RULES_MANAGEMENT_URL);

Expand Down

0 comments on commit c30272f

Please sign in to comment.