Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] Single metric viewer functional test: add retry to reduce flakiness #188686

Merged
merged 2 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});

for (const testData of testDataList) {
// FLAKY: https://github.com/elastic/kibana/issues/188493
describe.skip(testData.suiteSuffix, function () {
describe(testData.suiteSuffix, function () {
before(async () => {
await ml.api.createAndRunAnomalyDetectionLookbackJob(
testData.jobConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export function MachineLearningSingleMetricViewerProvider(
},

async ensureAnomalyActionDiscoverButtonClicked() {
await retry.tryForTime(3 * 1000, async () => {
await retry.tryForTime(10 * 1500, async () => {
Copy link
Member

Choose a reason for hiding this comment

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

Quick nit on the format: we tend to only change the first factor and leave the * 1000 so it's easier to see at glance how many seconds this timeout is.

await testSubjects.click('mlAnomaliesListRowAction_viewInDiscoverButton');
await testSubjects.existOrFail('discoverLayoutResizableContainer');
Copy link
Member

Choose a reason for hiding this comment

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

From the failure screenshot it looks like the click didn't have an effect (might have been triggered too early) and the click should be retried. However looking into the test log, I can see that this existOrFail times out after 120 seconds and since the wrapping retry is on a shorter time out, it leaves the retry immediately and never actually triggers the click again.
I'd propose to give the existOrFail an explicit timeout (as much as we think makes sense for going to the dashboard page, e.g. 10 seconds) and then extend the wrapping retry so it actually gives it a few tries, something like this:

    async ensureAnomalyActionDiscoverButtonClicked() {
      await retry.tryForTime(30 * 1000, async () => {
        await testSubjects.click('mlAnomaliesListRowAction_viewInDiscoverButton');
        await testSubjects.existOrFail('discoverLayoutResizableContainer', { timeout: 10 * 1000 });
      });
    },

});
Expand Down