Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Security Solution] fixes Data Quality dashboard errors when a basePath is configured #156233

Merged

Conversation

andrew-goldstein
Copy link
Contributor

@andrew-goldstein andrew-goldstein commented Apr 29, 2023

[Security Solution] fixes Data Quality dashboard errors when a basePath is configured

This PR implements a fix for an issue where the Data Quality dashboard displays errors when a basePath is configured, preventing indices from being checked.

Desk testing

yarn start --no-base-path

Before / after screenshots

Before:

before

Above: Before the fix, errors occur when a basePath is configured

After:

after

Above: After the fix, errors do NOT occur

@andrew-goldstein andrew-goldstein added bug Fixes for quality problems that affect the customer experience release_note:fix Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Threat Hunting:Investigations Security Solution Investigations Team v8.8.0 v8.9.0 labels Apr 29, 2023
@andrew-goldstein andrew-goldstein self-assigned this Apr 29, 2023
@andrew-goldstein andrew-goldstein requested review from a team as code owners April 29, 2023 01:40
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@andrew-goldstein
Copy link
Contributor Author

Files by Code Owner

elastic/security-threat-hunting-explore

  • x-pack/plugins/security_solution/public/overview/pages/data_quality.test.tsx
  • x-pack/plugins/security_solution/public/overview/pages/data_quality.tsx

jest.clearAllMocks();

render(
<TestProviders>
<DataQualityDetails {...defaultProps} />
</TestProviders>
);

await waitFor(() => {});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guessing it's to make sure the DataQuality dashboard renders? Either way, do you mind adding a comment for these @andrew-goldstein ? 😄

@@ -200,46 +202,50 @@ const DataQualityComponent: React.FC = () => {
[createCaseFlyout]
);

if (isSourcererLoading) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (isSourcererLoading) {
if (isSourcererLoading || isSignalIndexNameLoading) {

Why not move both conditions up?

Copy link
Contributor

@stephmilovic stephmilovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, I can finally run with my base path 🎉 just a few minor comments, LGTM. Thanks for the fix!

jest.clearAllMocks();
});

describe('happy path', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: If you do end up adding another commit, can you re-label this to successful response from ilm endpoint or something.. This is fine too, just not the most descriptive 😄

jest.clearAllMocks();
});

describe('happy path', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

samesies if you end up adding a commit

mockHttpFetch.mockResolvedValue(mockStatsGreenIndex);
});

test('it returns the expected stats', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side question. I've seen it debated on a few PR's. Do you consider a benefit to having separate test blocks vs multiple expects in a single test block? Or even just testing the whole result.current object in one test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side question. I've seen it debated on a few PR's. Do you consider a benefit to having separate test blocks vs multiple expects in a single test block? Or even just testing the whole result.current object in one test?

I generally prefer to read and write "one assertion per test". That said, these tests had redundant test setup code. Per our offline discussion, I refactored-out the redundant setup code, and applied this pattern to the other test files in this PR.

Copy link
Contributor

@michaelolo24 michaelolo24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! Tested locally with and without a basePath, and just for completeness, multiple spaces in each. Everything looks to be working as expected. Thanks for getting this fix in!

@andrew-goldstein andrew-goldstein added this to the 8.8 milestone May 2, 2023
…sePath` is configured

This PR implements a fix for an [issue](elastic#156231) where the Data Quality dashboard displays errors when  a `basePath` is configured, preventing indices from being checked.

### Desk testing

- Verify the fix per the reporduction steps in <elastic#156231>
- Also verify the page still behaves correctly when Kibana is started with no base path, via:

```
yarn start --no-base-path
```

### Before / after screenshots

**Before:**

![before](https://user-images.githubusercontent.com/4459398/235273609-952fd7e4-0a22-4344-b1e4-48411c6d0e33.png)

_Above: Before the fix, errors occur when a `basePath` is configured_

**After:**

![after](https://user-images.githubusercontent.com/4459398/235276257-c62feb05-699a-418c-8da2-b90b6683e5b4.png)

_Above: After the fix, errors do NOT occur_
@andrew-goldstein
Copy link
Contributor Author

@elasticmachine merge upstream

@andrew-goldstein andrew-goldstein enabled auto-merge (squash) May 4, 2023 15:44
@andrew-goldstein
Copy link
Contributor Author

@elasticmachine merge upstream

@andrew-goldstein andrew-goldstein merged commit 3389a2b into elastic:main May 4, 2023
19 checks passed
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
securitySolution 3860 3861 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
securitySolution 9.1MB 9.1MB +423.0B
Unknown metric groups

ESLint disabled line counts

id before after diff
enterpriseSearch 19 21 +2
securitySolution 398 401 +3
total +5

Total ESLint disabled count

id before after diff
enterpriseSearch 20 22 +2
securitySolution 478 481 +3
total +5

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @andrew-goldstein

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request May 4, 2023
…ath` is configured (elastic#156233)

## [Security Solution] fixes Data Quality dashboard errors when a `basePath` is configured

This PR implements a fix for an [issue](elastic#156231) where the Data Quality dashboard displays errors when  a `basePath` is configured, preventing indices from being checked.

### Desk testing

- Verify the fix per the reporduction steps in <elastic#156231>
- Also verify the page still behaves correctly when Kibana is started with no base path, via:

```
yarn start --no-base-path
```

### Before / after screenshots

**Before:**

![before](https://user-images.githubusercontent.com/4459398/235273609-952fd7e4-0a22-4344-b1e4-48411c6d0e33.png)

_Above: Before the fix, errors occur when a `basePath` is configured_

**After:**

![after](https://user-images.githubusercontent.com/4459398/235276257-c62feb05-699a-418c-8da2-b90b6683e5b4.png)

_Above: After the fix, errors do NOT occur_

(cherry picked from commit 3389a2b)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.8

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request May 4, 2023
…`basePath` is configured (#156233) (#156730)

# Backport

This will backport the following commits from `main` to `8.8`:
- [[Security Solution] fixes Data Quality dashboard errors when a
`basePath` is configured
(#156233)](#156233)

<!--- Backport version: 8.9.7 -->

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

<!--BACKPORT [{"author":{"name":"Andrew
Macri","email":"andrew.macri@elastic.co"},"sourceCommit":{"committedDate":"2023-05-04T19:24:39Z","message":"[Security
Solution] fixes Data Quality dashboard errors when a `basePath` is
configured (#156233)\n\n## [Security Solution] fixes Data Quality
dashboard errors when a `basePath` is configured\r\n\r\nThis PR
implements a fix for an
[issue](#156231) where the Data
Quality dashboard displays errors when a `basePath` is configured,
preventing indices from being checked.\r\n\r\n### Desk testing\r\n\r\n-
Verify the fix per the reporduction steps in
<https://github.com/elastic/kibana/issues/156231>\r\n- Also verify the
page still behaves correctly when Kibana is started with no base path,
via:\r\n\r\n```\r\nyarn start --no-base-path\r\n```\r\n\r\n### Before /
after
screenshots\r\n\r\n**Before:**\r\n\r\n![before](https://user-images.githubusercontent.com/4459398/235273609-952fd7e4-0a22-4344-b1e4-48411c6d0e33.png)\r\n\r\n_Above:
Before the fix, errors occur when a `basePath` is
configured_\r\n\r\n**After:**\r\n\r\n![after](https://user-images.githubusercontent.com/4459398/235276257-c62feb05-699a-418c-8da2-b90b6683e5b4.png)\r\n\r\n_Above:
After the fix, errors do NOT
occur_","sha":"3389a2b35bf65fbb32ab10769997d4a210e95607","branchLabelMapping":{"^v8.9.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Team:
SecuritySolution","Team:Threat
Hunting:Investigations","v8.8.0","v8.9.0"],"number":156233,"url":"#156233
Solution] fixes Data Quality dashboard errors when a `basePath` is
configured (#156233)\n\n## [Security Solution] fixes Data Quality
dashboard errors when a `basePath` is configured\r\n\r\nThis PR
implements a fix for an
[issue](#156231) where the Data
Quality dashboard displays errors when a `basePath` is configured,
preventing indices from being checked.\r\n\r\n### Desk testing\r\n\r\n-
Verify the fix per the reporduction steps in
<https://github.com/elastic/kibana/issues/156231>\r\n- Also verify the
page still behaves correctly when Kibana is started with no base path,
via:\r\n\r\n```\r\nyarn start --no-base-path\r\n```\r\n\r\n### Before /
after
screenshots\r\n\r\n**Before:**\r\n\r\n![before](https://user-images.githubusercontent.com/4459398/235273609-952fd7e4-0a22-4344-b1e4-48411c6d0e33.png)\r\n\r\n_Above:
Before the fix, errors occur when a `basePath` is
configured_\r\n\r\n**After:**\r\n\r\n![after](https://user-images.githubusercontent.com/4459398/235276257-c62feb05-699a-418c-8da2-b90b6683e5b4.png)\r\n\r\n_Above:
After the fix, errors do NOT
occur_","sha":"3389a2b35bf65fbb32ab10769997d4a210e95607"}},"sourceBranch":"main","suggestedTargetBranches":["8.8"],"targetPullRequestStates":[{"branch":"8.8","label":"v8.8.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.9.0","labelRegex":"^v8.9.0$","isSourceBranch":true,"state":"MERGED","url":"#156233
Solution] fixes Data Quality dashboard errors when a `basePath` is
configured (#156233)\n\n## [Security Solution] fixes Data Quality
dashboard errors when a `basePath` is configured\r\n\r\nThis PR
implements a fix for an
[issue](#156231) where the Data
Quality dashboard displays errors when a `basePath` is configured,
preventing indices from being checked.\r\n\r\n### Desk testing\r\n\r\n-
Verify the fix per the reporduction steps in
<https://github.com/elastic/kibana/issues/156231>\r\n- Also verify the
page still behaves correctly when Kibana is started with no base path,
via:\r\n\r\n```\r\nyarn start --no-base-path\r\n```\r\n\r\n### Before /
after
screenshots\r\n\r\n**Before:**\r\n\r\n![before](https://user-images.githubusercontent.com/4459398/235273609-952fd7e4-0a22-4344-b1e4-48411c6d0e33.png)\r\n\r\n_Above:
Before the fix, errors occur when a `basePath` is
configured_\r\n\r\n**After:**\r\n\r\n![after](https://user-images.githubusercontent.com/4459398/235276257-c62feb05-699a-418c-8da2-b90b6683e5b4.png)\r\n\r\n_Above:
After the fix, errors do NOT
occur_","sha":"3389a2b35bf65fbb32ab10769997d4a210e95607"}}]}]
BACKPORT-->

Co-authored-by: Andrew Macri <andrew.macri@elastic.co>
jloleysens added a commit that referenced this pull request May 5, 2023
* main: (153 commits)
  [Security Solution] {{state.signals_count}} Object not working (#156472) (#156707)
  [Synthetics] refresh data on visualization scrubbing (#156777)
  [RAM] Docs for slack improvements (#153885)
  [RAM] Alert search bar only KQL (#155947)
  [ML] Functional tests - stabilize export job tests (#156586)
  [Saved Search] Update saved search schema to allow empty `sort` arrays (#156769)
  [ML] Rename `curated` model type to `elastic` (#156684)
  [Discover] Enable sharing for text based languages (#156652)
  [api-docs] 2023-05-05 Daily api_docs build (#156781)
  Upgrade EUI to v77.2.2 (#155208)
  [RAM][Maintenance Window][8.8]Fix window maintenance workflow (#156427)
  [DOCS] Case file attachments (#156459)
  [D4C] additional error handling for 'block' action added + policy editor UI fixes (#156629)
  [Enterprise Search] refactor(SearchApplications): rename telemetry ids (#156733)
  [Enterprise Search] Add telemetry to ELSER deployment buttons + error (#156545)
  [Security Solution] fixes Data Quality dashboard errors when a `basePath` is configured (#156233)
  [Logs onboarding] StepsFooter outside of main panel (#156686)
  [Security Solution] Add a migration to unmute custom Security Solution rules (#156593)
  [Enterprise Search][Behavioral Analytics] Update formulas (#156704)
  Add API Events to Endpoint Security Advanced Policy (#156718)
  ...
@andrew-goldstein andrew-goldstein deleted the data-quality-base-path-fix branch May 5, 2023 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience release_note:fix Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Threat Hunting:Investigations Security Solution Investigations Team v8.8.0 v8.9.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants