Skip to content

Commit

Permalink
[8.x] [DataUsage][Serverless] Add missing tests (#198007) (#199375)
Browse files Browse the repository at this point in the history
# Backport

This will backport the following commits from `main` to `8.x`:
- [[DataUsage][Serverless] Add missing tests
(#198007)](#198007)

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

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

<!--BACKPORT
[{"author":{"name":"Ash","email":"1849116+ashokaditya@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-11-07T19:57:46Z","message":"[DataUsage][Serverless]
Add missing tests (#198007)\n\n## Summary\r\n\r\nAdds missing UX/API
tests for changes added in \r\n-
https://github.com/elastic/kibana/pull/193966\r\n-
https://github.com/elastic/kibana/pull/197056\r\n-
https://github.com/elastic/kibana/pull/195556\r\n-
https://github.com/elastic/kibana/pull/196559\r\n\r\n\r\n###
Checklist\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"207894edd5c8bd2530dee2f54d47b4f497aa3687","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:version","v8.17.0"],"title":"[DataUsage][Serverless]
Add missing
tests","number":198007,"url":"https://github.com/elastic/kibana/pull/198007","mergeCommit":{"message":"[DataUsage][Serverless]
Add missing tests (#198007)\n\n## Summary\r\n\r\nAdds missing UX/API
tests for changes added in \r\n-
https://github.com/elastic/kibana/pull/193966\r\n-
https://github.com/elastic/kibana/pull/197056\r\n-
https://github.com/elastic/kibana/pull/195556\r\n-
https://github.com/elastic/kibana/pull/196559\r\n\r\n\r\n###
Checklist\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"207894edd5c8bd2530dee2f54d47b4f497aa3687"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/198007","number":198007,"mergeCommit":{"message":"[DataUsage][Serverless]
Add missing tests (#198007)\n\n## Summary\r\n\r\nAdds missing UX/API
tests for changes added in \r\n-
https://github.com/elastic/kibana/pull/193966\r\n-
https://github.com/elastic/kibana/pull/197056\r\n-
https://github.com/elastic/kibana/pull/195556\r\n-
https://github.com/elastic/kibana/pull/196559\r\n\r\n\r\n###
Checklist\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"207894edd5c8bd2530dee2f54d47b4f497aa3687"}},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Ash <1849116+ashokaditya@users.noreply.github.com>
  • Loading branch information
kibanamachine and ashokaditya authored Nov 7, 2024
1 parent 21cc331 commit de032ca
Show file tree
Hide file tree
Showing 20 changed files with 1,344 additions and 215 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
/* eslint-disable no-console */
export const dataUsageTestQueryClientOptions = {
defaultOptions: {
queries: {
retry: false,
cacheTime: 0,
},
},
logger: {
log: console.log,
warn: console.warn,
error: () => {},
},
};
7 changes: 5 additions & 2 deletions x-pack/plugins/data_usage/public/app/components/charts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,21 @@ import { EuiFlexGroup } from '@elastic/eui';
import { MetricTypes } from '../../../common/rest_types';
import { ChartPanel } from './chart_panel';
import { UsageMetricsResponseSchemaBody } from '../../../common/rest_types';
import { useTestIdGenerator } from '../../hooks/use_test_id_generator';
interface ChartsProps {
data: UsageMetricsResponseSchemaBody;
'data-test-subj'?: string;
}

export const Charts: React.FC<ChartsProps> = ({ data }) => {
export const Charts: React.FC<ChartsProps> = ({ data, 'data-test-subj': dataTestSubj }) => {
const getTestId = useTestIdGenerator(dataTestSubj);
const [popoverOpen, setPopoverOpen] = useState<string | null>(null);
const togglePopover = useCallback((streamName: string | null) => {
setPopoverOpen((prev) => (prev === streamName ? null : streamName));
}, []);

return (
<EuiFlexGroup direction="column">
<EuiFlexGroup direction="column" data-test-subj={getTestId('charts')}>
{Object.entries(data.metrics).map(([metricType, series], idx) => (
<ChartPanel
key={metricType}
Expand Down
Loading

0 comments on commit de032ca

Please sign in to comment.