Skip to content

Fixes flaky server metrics collector integration tests - #121469

Merged
TinaHeiligers merged 4 commits into
elastic:mainfrom
TinaHeiligers:kbn-59234-flaky-server-metrics-collector-int-test
Dec 21, 2021
Merged

TinaHeiligers merged 4 commits into
elastic:mainfrom
TinaHeiligers:kbn-59234-flaky-server-metrics-collector-int-test

Conversation

@TinaHeiligers

Copy link
Copy Markdown
Contributor

Resolves #59234

Increases requestWaitDelay from 25 to 35
Adds statusCodes to metrics.requests assertion
Improves response times assertions.

@TinaHeiligers TinaHeiligers added 8.0.1 v8.0.0 v7.16.2 v7.17.0 v8.1.0 auto-backport Deprecated - use backport:version if exact versions are needed release_note:skip Skip the PR/issue when compiling release notes and removed 8.0.1 labels Dec 16, 2021
@TinaHeiligers
TinaHeiligers marked this pull request as ready for review December 17, 2021 18:40
@TinaHeiligers
TinaHeiligers requested a review from a team as a code owner December 17, 2021 18:40
@TinaHeiligers TinaHeiligers added the Team:Core Platform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t// label Dec 17, 2021
@elasticmachine

Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-core (Team:Core)

@TinaHeiligers

Copy link
Copy Markdown
Contributor Author

@elasticmachine merge upstream

import { setTimeout as setTimeoutPromise } from 'timers/promises';

const requestWaitDelay = 25;
const requestWaitDelay = 35;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this run against the flaky runner?

In the failing test, we are explicitly waiting until all the requests have at least been reaching the handler, via

await hitSubject
.pipe(
filter((count) => count >= 2),
take(1)
)
.toPromise();

So I'm not quite sure just increase the delay where we were already waiting should really resolves the flakiness, because in theory, we should not get to the assertions because all requests have reached the server? So I'm suspecting the flakiness is appearing from elsewhere.

Maybe we should also be adding an await delay(requestWaitDelay); between await hitSubject... and let metrics = await collector.collect(); to some times for the HAPI internals?

@TinaHeiligers TinaHeiligers Dec 20, 2021 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this run against the flaky runner?

The buildkite flaky test runner doesn't run jest tests yet but our Jenkins runner does 😄
https://kibana-ci.elastic.co/job/kibana+flaky-test-suite-runner/2162/
The metrics integration tests passed 42/42 times on 7f89ebd

So I'm suspecting the flakiness is appearing from elsewhere

I'll dig deeper...

@TinaHeiligers TinaHeiligers Dec 21, 2021 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, after some digging it seems like the flakiness is because the requests aren't always being triggered with supertest(hapiServer.listener).get('/disconnect).end() before the assertions.

The /disconnect router hangs on new Promise((resolve) => undefined) which is how we're mimicking the disconnection.

Even though the callback to .end is optional, I've added one anyway since we're not awaiting the request. That and the added delay should hopefully help stabilize the tests.

Flaky test runner job with these changes: https://kibana-ci.elastic.co/job/kibana+flaky-test-suite-runner/2163/
passed 10/10 times.

@TinaHeiligers

Copy link
Copy Markdown
Contributor Author

@elasticmachine merge upstream

@kibana-ci

Copy link
Copy Markdown

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@TinaHeiligers
TinaHeiligers merged commit 8d621b7 into elastic:main Dec 21, 2021
@TinaHeiligers
TinaHeiligers deleted the kbn-59234-flaky-server-metrics-collector-int-test branch December 21, 2021 14:59
kibanamachine added a commit to kibanamachine/kibana that referenced this pull request Dec 21, 2021
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
@kibanamachine

Copy link
Copy Markdown
Contributor

💔 Backport failed

Status Branch Result
✅ 8.0
❌ 7.17 Commit could not be cherrypicked due to conflicts
❌ 7.16 Commit could not be cherrypicked due to conflicts

Successful backport PRs will be merged automatically after passing CI.

To backport manually run:
node scripts/backport --pr 121469

kibanamachine added a commit that referenced this pull request Dec 21, 2021
…1776)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Christiane (Tina) Heiligers <christiane.heiligers@elastic.co>
TinaHeiligers added a commit to TinaHeiligers/kibana that referenced this pull request Dec 21, 2021
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
# Conflicts:
#	src/core/server/metrics/integration_tests/server_collector.test.ts
TinaHeiligers added a commit to TinaHeiligers/kibana that referenced this pull request Dec 21, 2021
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
# Conflicts:
#	src/core/server/metrics/integration_tests/server_collector.test.ts
TinaHeiligers added a commit that referenced this pull request Dec 21, 2021
…1799)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
# Conflicts:
#	src/core/server/metrics/integration_tests/server_collector.test.ts
TinaHeiligers added a commit that referenced this pull request Dec 21, 2021
…1800)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
# Conflicts:
#	src/core/server/metrics/integration_tests/server_collector.test.ts
patrykkopycinski pushed a commit to patrykkopycinski/kibana that referenced this pull request May 6, 2026
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-backport Deprecated - use backport:version if exact versions are needed release_note:skip Skip the PR/issue when compiling release notes Team:Core Platform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t// v7.16.2 v7.17.0 v8.0.0 v8.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failing test: Jest Integration Tests.src/core/server/metrics/integration_tests - ServerMetricsCollector collect disconnects requests infos

5 participants