[8.x] 🌊 Streams: Unskip and complete dashboard suggestion tests (#210368) (#211185)

# Backport

This will backport the following commits from `main` to `8.x`:
- [🌊 Streams: Unskip and complete dashboard suggestion tests
(#210368)](https://github.com/elastic/kibana/pull/210368)

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

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

<!--BACKPORT [{"author":{"name":"Joe
Reuter","email":"johannes.reuter@elastic.co"},"sourceCommit":{"committedDate":"2025-02-14T09:57:33Z","message":"🌊
Streams: Unskip and complete dashboard suggestion tests
(#210368)\n\nCloses
https://github.com/elastic/kibana/issues/208016\n\nAdds a new dataset
for the tag-association test (didn't find a good\nexisting one)\n\nFor
the MKI flakiness, I don't think this is related to this test
but\nrather another test leaking SOs. I added some robustness against
this,\nbut ideally we fix this in the offending test. Maybe we should
add a\nlittle something that checks for leaky state after a suite closes
and\nfails if there is something? That goes beyond the scope of this
issue\nthough.","sha":"455f36bddeb90b45f5e7acca6c4dd58ee2d30456","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:version","Feature:Streams","v9.1.0","v8.19.0"],"title":"🌊
Streams: Unskip and complete dashboard suggestion
tests","number":210368,"url":"https://github.com/elastic/kibana/pull/210368","mergeCommit":{"message":"🌊
Streams: Unskip and complete dashboard suggestion tests
(#210368)\n\nCloses
https://github.com/elastic/kibana/issues/208016\n\nAdds a new dataset
for the tag-association test (didn't find a good\nexisting one)\n\nFor
the MKI flakiness, I don't think this is related to this test
but\nrather another test leaking SOs. I added some robustness against
this,\nbut ideally we fix this in the offending test. Maybe we should
add a\nlittle something that checks for leaky state after a suite closes
and\nfails if there is something? That goes beyond the scope of this
issue\nthough.","sha":"455f36bddeb90b45f5e7acca6c4dd58ee2d30456"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/210368","number":210368,"mergeCommit":{"message":"🌊
Streams: Unskip and complete dashboard suggestion tests
(#210368)\n\nCloses
https://github.com/elastic/kibana/issues/208016\n\nAdds a new dataset
for the tag-association test (didn't find a good\nexisting one)\n\nFor
the MKI flakiness, I don't think this is related to this test
but\nrather another test leaking SOs. I added some robustness against
this,\nbut ideally we fix this in the offending test. Maybe we should
add a\nlittle something that checks for leaky state after a suite closes
and\nfails if there is something? That goes beyond the scope of this
issue\nthough.","sha":"455f36bddeb90b45f5e7acca6c4dd58ee2d30456"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Joe Reuter <johannes.reuter@elastic.co>
This commit is contained in:
Kibana Machine 2025-02-14 22:49:19 +11:00 committed by GitHub
parent 7c45530aab
commit 045710683f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 115 additions and 3 deletions

1
.github/CODEOWNERS vendored
View file

@ -1320,6 +1320,7 @@ packages/kbn-monaco/src/esql @elastic/kibana-esql
# Streams
/x-pack/test/api_integration/deployment_agnostic/apis/observability/streams @elastic/streams-program-team
/x-pack/test/api_integration/fixtures/kbn_archiver/streams @elastic/streams-program-team
### END Observability Plugins

View file

@ -24,13 +24,23 @@ export default function ({ getService }: DeploymentAgnosticFtrProviderContext) {
const ARCHIVES = [
'test/api_integration/fixtures/kbn_archiver/saved_objects/search.json',
'test/api_integration/fixtures/kbn_archiver/saved_objects/basic.json',
'x-pack/test/api_integration/fixtures/kbn_archiver/streams/tagged_dashboard.json',
];
const SEARCH_DASHBOARD_ID = 'b70c7ae0-3224-11e8-a572-ffca06da1357';
const BASIC_DASHBOARD_ID = 'be3733a0-9efe-11e7-acb3-3dab96693fab';
const BASIC_DASHBOARD_TITLE = 'Requests';
const TAG_ID = '00ad6a46-6ac3-4f6c-892c-2f72c54a5e7d';
async function loadDashboards() {
// clear out all lingering dashboards
const dashboards = await kibanaServer.savedObjects.find({
type: 'dashboard',
});
await kibanaServer.savedObjects.bulkDelete({
objects: dashboards.saved_objects.map((d) => ({ type: 'dashboard', id: d.id })),
});
for (const archive of ARCHIVES) {
await kibanaServer.importExport.load(archive, { space: SPACE_ID });
}
@ -250,11 +260,20 @@ export default function ({ getService }: DeploymentAgnosticFtrProviderContext) {
);
expect(response.status).to.eql(200);
expect(response.body.suggestions.length).to.eql(2);
expect(response.body.suggestions.length).to.eql(3);
});
// TODO: needs a dataset with dashboards with tags
it.skip('filters suggested dashboards based on tags', () => {});
it('filters suggested dashboards based on tags', async () => {
const response = await apiClient.fetch(
'POST /api/streams/{name}/dashboards/_suggestions',
{
params: { path: { name: 'logs' }, body: { tags: [TAG_ID] }, query: { query: '' } },
}
);
expect(response.status).to.eql(200);
expect(response.body.suggestions.length).to.eql(1);
});
it('filters suggested dashboards based on the query', async () => {
const response = await apiClient.fetch(

View file

@ -0,0 +1,92 @@
{
"id": "3fdaa535-5baf-46bc-8265-705eda43b999",
"type": "visualization",
"namespaces": [
"default"
],
"coreMigrationVersion": "8.8.0",
"typeMigrationVersion": "8.5.0",
"updated_at": "2023-04-24T19:57:13.859Z",
"created_at": "2023-04-24T19:57:13.859Z",
"version": "WzExNCwxXQ==",
"attributes": {
"description": "",
"kibanaSavedObjectMeta": {
"searchSourceJSON": "{\"filter\":[],\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"indexRefName\":\"kibanaSavedObjectMeta.searchSourceJSON.index\"}"
},
"title": "Managed Count of requests",
"uiStateJSON": "{\"spy\":{\"mode\":{\"name\":null,\"fill\":false}}}",
"version": 1,
"visState": "{\"title\":\"Count of requests\",\"type\":\"area\",\"params\":{\"type\":\"area\",\"grid\":{\"categoryLines\":false,\"style\":{\"color\":\"#eee\"}},\"categoryAxes\":[{\"id\":\"CategoryAxis-1\",\"type\":\"category\",\"position\":\"bottom\",\"show\":true,\"style\":{},\"scale\":{\"type\":\"linear\"},\"labels\":{\"show\":true,\"truncate\":100,\"filter\":true},\"title\":{}}],\"valueAxes\":[{\"id\":\"ValueAxis-1\",\"name\":\"LeftAxis-1\",\"type\":\"value\",\"position\":\"left\",\"show\":true,\"style\":{},\"scale\":{\"type\":\"linear\",\"mode\":\"normal\"},\"labels\":{\"show\":true,\"rotate\":0,\"filter\":false,\"truncate\":100},\"title\":{\"text\":\"Count\"}}],\"seriesParams\":[{\"show\":\"true\",\"type\":\"area\",\"mode\":\"stacked\",\"data\":{\"label\":\"Count\",\"id\":\"1\"},\"drawLinesBetweenPoints\":true,\"showCircles\":true,\"interpolate\":\"linear\",\"valueAxis\":\"ValueAxis-1\"}],\"addTooltip\":true,\"addLegend\":true,\"legendPosition\":\"right\",\"times\":[],\"addTimeMarker\":false,\"palette\":{\"type\":\"palette\",\"name\":\"kibana_palette\"},\"isVislibVis\":true,\"detailedTooltip\":true,\"fittingFunction\":\"zero\",\"legendSize\":\"auto\"},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"schema\":\"metric\",\"params\":{}},{\"id\":\"2\",\"enabled\":true,\"type\":\"date_histogram\",\"schema\":\"segment\",\"params\":{\"field\":\"@timestamp\",\"interval\":\"auto\",\"min_doc_count\":1,\"extended_bounds\":{}}}]}"
},
"references": [
{
"id": "91200a00-9efd-11e7-acb3-3dab96693fab",
"name": "kibanaSavedObjectMeta.searchSourceJSON.index",
"type": "index-pattern"
}
]
}
{
"id": "00ad6a46-6ac3-4f6c-892c-2f72c54a5e7d",
"type": "tag",
"namespaces": [
"default"
],
"coreMigrationVersion": "8.8.0",
"typeMigrationVersion": "8.0.0",
"updated_at": "2023-04-24T19:58:24.550Z",
"created_at": "2023-04-24T19:58:24.550Z",
"version": "WzEyMSwxXQ==",
"attributes": {
"color":"#f70250",
"description":"",
"name":"mytag"
},
"references": []
}
{
"id": "11fb046d-0e50-48a0-a410-a744b82cb999",
"type": "dashboard",
"namespaces": [
"default"
],
"coreMigrationVersion": "8.8.0",
"typeMigrationVersion": "8.7.0",
"updated_at": "2023-04-24T20:54:57.921Z",
"created_at": "2023-04-24T20:54:57.921Z",
"version": "WzMwOSwxXQ==",
"attributes": {
"description": "",
"hits": 0,
"kibanaSavedObjectMeta": {
"searchSourceJSON": "{\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[],\"highlightAll\":true,\"version\":true}"
},
"optionsJSON": "{\"darkTheme\":false}",
"panelsJSON": "[{\"version\":\"7.3.0\",\"type\":\"visualization\",\"gridData\":{\"x\":0,\"y\":0,\"w\":24,\"h\":12,\"i\":\"1\"},\"panelIndex\":\"1\",\"embeddableConfig\":{\"enhancements\":{}},\"panelRefName\":\"panel_1\"}]",
"refreshInterval": {
"display": "Off",
"pause": false,
"value": 0
},
"timeFrom": "Wed Sep 16 2015 22:52:17 GMT-0700",
"timeRestore": true,
"timeTo": "Fri Sep 18 2015 12:24:38 GMT-0700",
"title": "My test dashboard",
"version": 1
},
"references": [
{
"id": "dd7caf20-9efd-11e7-acb3-3dab96693fab",
"name": "1:panel_1",
"type": "visualization"
},
{
"id":"00ad6a46-6ac3-4f6c-892c-2f72c54a5e7d",
"name":"tag-ref-00ad6a46-6ac3-4f6c-892c-2f72c54a5e7d",
"type":"tag"
}
]
}