[Reporting] Serverless API/Functional tests: fix to delete all reports (#184616)

I was looking at proxy logs for an API integration test in serverless,
and I noticed that when called on ES to delete all reports, we are using
the "old" index pattern, which should have been updated when we switched
Reporting to use a data stream.

We sometimes need to delete all of the reports from storage for testing,
because we validate that a certain list of reports will appear in the
list of reports will be returned from the "listing" API.

Flaky test run:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/6206

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Tim Sullivan 2024-06-04 13:11:50 -07:00 committed by GitHub
parent 5315fb177a
commit 1cae10d307
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View file

@ -9,6 +9,7 @@ import { X_ELASTIC_INTERNAL_ORIGIN_REQUEST } from '@kbn/core-http-common';
import expect from '@kbn/expect';
import { INTERNAL_ROUTES } from '@kbn/reporting-common';
import type { ReportingJobResponse } from '@kbn/reporting-plugin/server/types';
import { REPORTING_DATA_STREAM_WILDCARD_WITH_LEGACY } from '@kbn/reporting-server';
import rison from '@kbn/rison';
import { FtrProviderContext } from '../../functional/ftr_provider_context';
@ -118,7 +119,9 @@ export function SvlReportingServiceProvider({ getService }: FtrProviderContext)
// ignores 409 errs and keeps retrying
await retry.tryForTime(5000, async () => {
await supertest.post('/.reporting*/_delete_by_query').send({ query: { match_all: {} } });
await supertest
.post(`/${REPORTING_DATA_STREAM_WILDCARD_WITH_LEGACY}/_delete_by_query`)
.send({ query: { match_all: {} } });
});
},
};

View file

@ -100,6 +100,7 @@
"@kbn/synthetics-plugin",
"@kbn/dataset-quality-plugin",
"@kbn/alerting-comparators",
"@kbn/search-types"
"@kbn/search-types",
"@kbn/reporting-server"
]
}