Skip to content

Commit

Permalink
[Security Solution] Integration tests for scalar array diff algorithm (
Browse files Browse the repository at this point in the history
…#187778)

## Summary

Completes #180162

Switches fields to use the scalar array diff algorithms assigned to them
in the [overarching
ticket](#180162 (comment))

Adds integration tests in accordance to
#186325 for the upgrade/_review
API endpoint for the scalar array diff algorithm.

### 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
- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed



### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
  • Loading branch information
dplumlee authored Jul 11, 2024
1 parent 8c4c51f commit 76cc844
Show file tree
Hide file tree
Showing 5 changed files with 915 additions and 333 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import { MissingVersion } from '../../../../../../../common/api/detection_engine
import { calculateFieldsDiffFor } from './diff_calculation_helpers';
import {
numberDiffAlgorithm,
scalarArrayDiffAlgorithm,
simpleDiffAlgorithm,
singleLineStringDiffAlgorithm,
} from './algorithms';
Expand Down Expand Up @@ -174,20 +175,20 @@ const commonFieldsDiffAlgorithms: FieldsDiffAlgorithmsFor<DiffableCommonFields>
rule_id: simpleDiffAlgorithm,
version: numberDiffAlgorithm,
name: singleLineStringDiffAlgorithm,
tags: simpleDiffAlgorithm,
tags: scalarArrayDiffAlgorithm,
description: simpleDiffAlgorithm,
severity: singleLineStringDiffAlgorithm,
severity_mapping: simpleDiffAlgorithm,
risk_score: numberDiffAlgorithm,
risk_score_mapping: simpleDiffAlgorithm,
references: simpleDiffAlgorithm,
references: scalarArrayDiffAlgorithm,
false_positives: simpleDiffAlgorithm,
threat: simpleDiffAlgorithm,
note: simpleDiffAlgorithm,
setup: simpleDiffAlgorithm,
related_integrations: simpleDiffAlgorithm,
required_fields: simpleDiffAlgorithm,
author: simpleDiffAlgorithm,
author: scalarArrayDiffAlgorithm,
license: singleLineStringDiffAlgorithm,
rule_schedule: simpleDiffAlgorithm,
exceptions_list: simpleDiffAlgorithm,
Expand Down Expand Up @@ -259,7 +260,7 @@ const threatMatchFieldsDiffAlgorithms: FieldsDiffAlgorithmsFor<DiffableThreatMat
kql_query: simpleDiffAlgorithm,
data_source: simpleDiffAlgorithm,
threat_query: simpleDiffAlgorithm,
threat_index: simpleDiffAlgorithm,
threat_index: scalarArrayDiffAlgorithm,
threat_mapping: simpleDiffAlgorithm,
threat_indicator_path: singleLineStringDiffAlgorithm,
concurrent_searches: simpleDiffAlgorithm,
Expand Down Expand Up @@ -302,7 +303,7 @@ const newTermsFieldsDiffAlgorithms: FieldsDiffAlgorithmsFor<DiffableNewTermsFiel
type: simpleDiffAlgorithm,
kql_query: simpleDiffAlgorithm,
data_source: simpleDiffAlgorithm,
new_terms_fields: simpleDiffAlgorithm,
new_terms_fields: scalarArrayDiffAlgorithm,
history_window_start: singleLineStringDiffAlgorithm,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export default ({ loadTestFile }: FtrProviderContext): void => {
loadTestFile(require.resolve('./upgrade_prebuilt_rules'));
loadTestFile(require.resolve('./upgrade_prebuilt_rules_with_historical_versions'));
loadTestFile(require.resolve('./fleet_integration'));
loadTestFile(require.resolve('./upgrade_review_prebuilt_rules'));
loadTestFile(require.resolve('./upgrade_review_prebuilt_rules.number_fields'));
loadTestFile(require.resolve('./upgrade_review_prebuilt_rules.single_line_string_fields'));
loadTestFile(require.resolve('./upgrade_review_prebuilt_rules.scalar_array_fields'));
});
};
Loading

0 comments on commit 76cc844

Please sign in to comment.