Fix unknown product test flaky behavior (#148616)

Fixes https://github.com/elastic/kibana/issues/129754

The failing integration test is querying the `/api/status` endpoint
before Kibana and ES are completely initialized, and thus, it is getting
a _unavailable: Waiting for Elasticsearch_ instead of the expected
_critical_.

The proposed fix consists in awaiting a few milliseconds, in order to
give the `debounceTime` operators enough time to propagate the right
status.

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Gerard Soldevila 2023-01-11 15:20:37 +01:00 committed by GitHub
parent 15a4a00693
commit 9f39b78562
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -69,7 +69,7 @@ function createFakeElasticsearchServer() {
}
// FLAKY: https://github.com/elastic/kibana/issues/129754
describe.skip('fake elasticsearch', () => {
describe('fake elasticsearch', () => {
let esServer: http.Server;
let kibanaServer: Root;
let kibanaHttpServer: http.Server;
@ -81,6 +81,10 @@ describe.skip('fake elasticsearch', () => {
const kibanaPreboot = await kibanaServer.preboot();
kibanaHttpServer = kibanaPreboot.http.server.listener; // Mind that we are using the prebootServer at this point because the migration gets hanging, while waiting for ES to be correct
await kibanaServer.setup();
// give kibanaServer's status Observables enough time to bootstrap
// and emit a status after the initial "unavailable: Waiting for Elasticsearch"
// see https://github.com/elastic/kibana/issues/129754
await new Promise((resolve) => setTimeout(resolve, 500));
});
afterAll(async () => {