🌊 Streams: Unskip and complete dashboard suggestion tests (#210368)

Closes https://github.com/elastic/kibana/issues/208016

Adds a new dataset for the tag-association test (didn't find a good
existing one)

For the MKI flakiness, I don't think this is related to this test but
rather another test leaking SOs. I added some robustness against this,
but ideally we fix this in the offending test. Maybe we should add a
little something that checks for leaky state after a suite closes and
fails if there is something? That goes beyond the scope of this issue
though.
This commit is contained in:
Joe Reuter 2025-02-14 10:57:33 +01:00 committed by GitHub
parent 995b851148
commit 455f36bdde
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 115 additions and 5 deletions

1
.github/CODEOWNERS vendored
View file

@ -1464,6 +1464,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 });
}
@ -241,8 +251,6 @@ export default function ({ getService }: DeploymentAgnosticFtrProviderContext) {
});
describe('after creating multiple dashboards', () => {
// see details: https://github.com/elastic/kibana/issues/208016
this.tags(['failsOnMKI']);
it('suggests dashboards to link', async () => {
const response = await apiClient.fetch(
'POST /api/streams/{name}/dashboards/_suggestions',
@ -252,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"
}
]
}